Hi all,
I have two RadListBox(s) that transfer to each other. Both are populated using <ItemTemplate> and DataBind() with database data from code behind.
When I transfer one item to another, the row appears in the respective RadListBox but it does not show data. I've attached a picture with a side by side before and after.
Can anyone let me know what I'm doing wrong?
Code as below
Code Behind:
I have two RadListBox(s) that transfer to each other. Both are populated using <ItemTemplate> and DataBind() with database data from code behind.
When I transfer one item to another, the row appears in the respective RadListBox but it does not show data. I've attached a picture with a side by side before and after.
Can anyone let me know what I'm doing wrong?
Code as below
<
telerik:RadPageView
ID
=
"RadPageView_Visitor_Authentication"
runat
=
"server"
>
<
br
/>
<
asp:Table
runat
=
"server"
CssClass
=
"form_table"
>
<
asp:TableRow
runat
=
"Server"
>
<
asp:TableCell
runat
=
"server"
CssClass
=
"form_label_center"
>
<
asp:Label
ID
=
"Label_Available_Terminals"
runat
=
"server"
Text
=
"Available Terminals:"
CssClass
=
"form_span"
></
asp:Label
>
</
asp:TableCell
>
</
asp:TableRow
>
<
asp:TableRow
runat
=
"Server"
>
<
asp:TableCell
runat
=
"server"
CssClass
=
"form_label_center"
>
<
telerik:RadListBox
runat
=
"server"
ID
=
"RadListBox_Available_Terminals"
Height
=
"150px"
Width
=
"300px"
AllowTransfer
=
"true"
TransferToID
=
"RadListBox_Authenticate_Terminals"
OnTransferring
=
"Authenticating_Terminals_Transferring"
AutoPostBackOnTransfer
=
"true"
>
<
HeaderTemplate
>
<
table
width
=
"100%"
>
<
tr
>
<
td
width
=
"20%"
>
<
asp:Label
ID
=
"Label7"
runat
=
"server"
Text
=
"Admin"
></
asp:Label
>
</
td
>
<
td
width
=
"80%"
>
<
div
align
=
"left"
>
<
asp:Label
ID
=
"Label8"
runat
=
"server"
Text
=
"Terminal - Location"
></
asp:Label
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
table
width
=
"100%"
>
<
tr
>
<
td
width
=
"20%"
>
<
asp:CheckBox
runat
=
"server"
ID
=
"chk_admin"
Checked
=
"false"
Enabled
=
"false"
/>
</
td
>
<
td
width
=
"80%"
>
<
div
align
=
"left"
>
<
asp:Label
runat
=
"server"
ID
=
"Label_Terminal_Details_1"
>
<%# DataBinder.Eval(Container, "Attributes['Terminal_String']") %>
</
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"Label_Terminal_Nitgen_ID_1"
Visible
=
"false"
>
<%# DataBinder.Eval(Container, "Attributes['Terminal_Nitgen_ID']")%>
</
asp:Label
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
<
FooterTemplate
>
<
br
/>
</
FooterTemplate
>
<
ButtonSettings
Position
=
"Bottom"
HorizontalAlign
=
"Center"
/>
</
telerik:RadListBox
>
</
asp:TableCell
>
</
asp:TableRow
>
<
asp:TableRow
runat
=
"Server"
>
<
asp:TableCell
runat
=
"server"
CssClass
=
"form_td_center"
>
<
span
class
=
"form_span"
>
<
asp:Literal
ID
=
"Literal_Visitor_Name_Terminal"
runat
=
"server"
></
asp:Literal
>
<
asp:Label
ID
=
"Label_Authentication_On"
runat
=
"server"
Text
=
" Can Authenticate On:"
></
asp:Label
>
</
span
>
</
asp:TableCell
>
</
asp:TableRow
>
<
asp:TableRow
runat
=
"Server"
>
<
asp:TableCell
runat
=
"server"
CssClass
=
"form_td_center"
>
<
telerik:RadListBox
runat
=
"server"
ID
=
"RadListBox_Authenticate_Terminals"
Height
=
"120px"
Width
=
"300px"
>
<
HeaderTemplate
>
<
table
width
=
"100%"
>
<
tr
>
<
td
width
=
"20%"
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Admin"
></
asp:Label
>
</
td
>
<
td
width
=
"80%"
>
<
div
align
=
"left"
>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
Text
=
"Terminal - Location"
></
asp:Label
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
table
width
=
"100%"
>
<
tr
>
<
td
width
=
"20%"
>
<
asp:CheckBox
runat
=
"server"
ID
=
"chk_admin"
Checked
=
"false"
OnCheckedChanged
=
"User_Terminal_Admin_check_changed"
AutoPostBack
=
"True"
/>
</
td
>
<
td
width
=
"80%"
>
<
div
align
=
"left"
>
<
asp:Label
runat
=
"server"
ID
=
"Label_Terminal_Details"
>
<%# DataBinder.Eval(Container, "Attributes['Terminal_String']") %>
</
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"Label_Terminal_Nitgen_ID"
Visible
=
"false"
>
<%# DataBinder.Eval(Container, "Attributes['Terminal_Nitgen_ID']")%>
</
asp:Label
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadListBox
>
</
asp:TableCell
>
</
asp:TableRow
>
</
asp:Table
>
</
telerik:RadPageView
>
Code Behind:
//Get All Terminals
TD_Cmd = TDConnection.CreateCommand();
TD_Cmd.CommandText =
"EXECUTE "
+ SQL_Customer_Connection.Product_Name +
"_sp_Terminal_List "
+
"@Param_Customer_ID_Ref = @Param_Customer_ID_Ref1, "
+
"@Param_Company_ID_Ref = @Param_Company_ID_Ref1"
;
TD_Cmd.Parameters.Add(
new
SqlParameter(
"@Param_Customer_ID_Ref1"
,
(
string
)HttpContext.Current.Session[
"User_Belongs_To_Customer_Ref_ID"
]));
TD_Cmd.Parameters.Add(
new
SqlParameter(
"@Param_Company_ID_Ref1"
,
(
string
)HttpContext.Current.Session[
"User_Belongs_To_Company_Ref_ID"
]));
TD_DR = TD_Cmd.ExecuteReader();
while
(TD_DR.Read())
{
RadListBoxItem new_item =
new
RadListBoxItem();
new_item.Attributes.Add(
"Terminal_String"
,
(
string
)TD_DR[
"Terminal_Name"
] +
" - "
+ (
string
)TD_DR[
"Terminal_Location"
]);
new_item.Attributes.Add(
"Terminal_Nitgen_ID"
, (Convert.ToInt32(TD_DR[
"Nitgen_Terminal_ID_Ref"
])).ToString());
RadListBox_Available_Terminals.Items.Add(new_item);
RadListBox_Available_Terminals.DataBind();
}
TD_DR.Close();
//Get List of Terminals that this visitor can authenticate on
TD_Cmd = TDConnection.CreateCommand();
TD_Cmd.CommandText =
"EXECUTE "
+ SQL_Customer_Connection.Product_Name +
"_sp_Terminal_User_Authentication_List "
+
"@Param_Customer_ID_Ref = @Param_Customer_ID_Ref1, "
+
"@Param_Company_ID_Ref = @Param_Company_ID_Ref1, "
+
"@Param_User_ID = @Param_User_ID1"
;
TD_Cmd.Parameters.Add(
new
SqlParameter(
"@Param_Customer_ID_Ref1"
,
(
string
)HttpContext.Current.Session[
"User_Belongs_To_Customer_Ref_ID"
]));
TD_Cmd.Parameters.Add(
new
SqlParameter(
"@Param_Company_ID_Ref1"
,
(
string
)HttpContext.Current.Session[
"User_Belongs_To_Company_Ref_ID"
]));
TD_Cmd.Parameters.Add(
new
SqlParameter(
"@Param_User_ID1"
,
Label_Visitor_ID1.Text));
TD_DR = TD_Cmd.ExecuteReader();
while
(TD_DR.Read())
{
RadListBoxItem new_item =
new
RadListBoxItem();
new_item.Attributes.Add(
"Terminal_String"
,
(
string
)TD_DR[
"Terminal_Name"
] +
" - "
+ (
string
)TD_DR[
"Terminal_Location"
]);
new_item.Attributes.Add(
"Terminal_Nitgen_ID"
, (Convert.ToInt32(TD_DR[
"Nitgen_Terminal_ID_Ref"
])).ToString());
RadListBox_Authenticate_Terminals.Items.Add(new_item);
RadListBox_Authenticate_Terminals.DataBind();
if
(Convert.ToInt32(TD_DR[
"User_Priv"
].ToString()) == 1)
{
//Master User
CheckBox current_checkbox = new_item.FindControl(
"chk_admin"
)
as
CheckBox;
current_checkbox.Checked =
true
;
}
}
RadListBox_Authenticate_Terminals.DataBind();
...........