これはSPです:
ALTER PROCEDURE [dbo].[MenuAction__Sel_UnSel]
-- Add the parameters for the stored procedure here
(
@MenuId INT
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
---- Unselected Record
Select a.Action,'DB' AS DML_TYP
from dbo.MenuAction_m a
Where NOT EXISTS (SELECT 1 FROM dbo.Menu_d AS b WHERE B.Action=A.Action AND B.MenuId=@MenuId);
---- Selected Record
Select c.MenuId,a.Action,'DB' AS DML_TYP
from dbo.MenuAction_m a,Menu_d as c
WHERE a.Action=c.Action and EXISTS (SELECT 1 FROM dbo.Menu_d AS b WHERE B.Action=A.Action AND b.MenuId=@MenuId and c.Action=b.Action and c.MenuId=b.MenuId) ;
END
これはデザインページです:
<tr class="odd">
<td class="column1">
<b>UnSelected Items</b>
</td>
<td>
<b>Selected Items</b>
</td>
</tr>
<tr>
<td class="column1">
<telerik:RadListBox ID="RadLstUnselectedIns" runat="server" AllowTransfer="true"
AutoPostBackOnTransfer="true" Height="120px" SelectionMode="Multiple" TransferToID="RadLstselectedIns">
<ButtonSettings TransferButtons="All" />
</telerik:RadListBox>
<telerik:RadToolTip ID="radToolTipRadLstUnselected" runat="server" RelativeTo="Element"
Height="40px" Text="This Actions are not Selected!" TargetControlID="RadLstUnselectedIns"
Position="MiddleRight" EnableAriaSupport="true">
</telerik:RadToolTip>
</td>
<td>
<telerik:RadListBox ID="RadLstselectedIns" runat="server" Height="120px">
</telerik:RadListBox>
<telerik:RadToolTip ID="radToolTipRadLstselectedIns" runat="server" RelativeTo="Element"
Height="40px" Text="This Actions are Selected!" TargetControlID="RadLstselectedIns"
Position="MiddleRight" EnableAriaSupport="true">
</telerik:RadToolTip>
</td>
</tr>
これはコードビハインドです:
protected void frmview_ItemInserting(object sender, FormViewInsertEventArgs e)
{
RadListBox lstUnselected = (RadListBox)frmview.FindControl("RadLstUnselectedIns");
DataSet dsData = objMenuMBAL.getAction(0);
DataTable dtDataunsel = dsData.Tables[0];
if (dtDataunsel.Rows.Count > 0)
{
lstUnselected.DataSource = dtDataunsel;
lstUnselected.DataTextField = "Action";
lstUnselected.DataValueField = "Action";
lstUnselected.DataBind();
}
RadListBox lstselected = (RadListBox)frmview.FindControl("RadLstselectedIns");
}