I have a RadListBox with checkboxes. I would like the user to be able to select an item in the listbox and click on an Edit link to open up a popup in which the user can edit the information based on the selected item. So I need to pass the selected value as an id (key) in the LoadContentFrom on my Telerik Window. I am not sure as to how to do this. I tried creating a hidden field and setting it using the OnClientItemChecked, but I am having difficulty actually getting the selected item and its value. The listbox is not being found - please see the code below.
Can you please point me in the right direction as to how to do what I need?
Thank you very much,
Donna
<
script
language
=
"javascript"
type
=
"text/javascript"
>
function setSelectedUser() {
var listBox = $find('<%= UsersLB.ClientID %>_ClientState');
var selectedItem = listBox.get_selectedItem();
document.getElementById("selectedUser").value = selectedItem.get_value());
}
</
script
>
<% UsersLB.DataSource = Model.userList
UsersLB.DataValueField = "Value"
UsersLB.DataTextField = "Text"
UsersLB.DataBind()
UserGroupsLB.DataSource = Model.userGroupList
UserGroupsLB.DataValueField = "Value"
UserGroupsLB.DataTextField = "Text"
UserGroupsLB.DataBind()
%>
<
div
id
=
"mainright"
>
<
asp:HiddenField
ID
=
"selectedUser"
runat
=
"server"
/>
<
div
>
<
telerik:RadListBox
ID
=
"UsersLB"
runat
=
"server"
CheckBoxes
=
"true"
Height
=
"300px"
OnClientItemChecked
=
"setSelectedUser()"
>
</
telerik:RadListBox
>
<
a
href
=
"#"
id
=
"newUser"
>New</
a
> <
a
href
=
"#"
id
=
"editUser"
>Edit</
a
>
<% Html.Telerik().Window().Name("CreateWindow") _
.LoadContentFrom("Create", "User") _
.Buttons(Function(buttons) buttons.Refresh().Maximize().Close()) _
.Draggable(True) _
.Height(450) _
.Width(500) _
.Resizable() _
.Title("Create New GMC Web User") _
.HtmlAttributes(New With {.class = "windows7"}) _
.Visible(False) _
.Render()
%>
<% Html.Telerik().Window().Name("EditWindow") _
.LoadContentFrom("Edit", "User") _
.Buttons(Function(buttons) buttons.Refresh().Maximize().Close()) _
.Draggable(True) _
.Height(450) _
.Width(500) _
.Resizable() _
.Title("Edit GMC Web User") _
.HtmlAttributes(New With {.class = "windows7"}) _
.Visible(False) _
.Render()
%>
</
div
>
<
div
>
<
telerik:RadListBox
ID
=
"UserGroupsLB"
runat
=
"server"
CheckBoxes
=
"true"
Height
=
"300px"
>
</
telerik:RadListBox
>
</
div
>
</
div
>
<% Html.Telerik().ScriptRegistrar().OnDocumentReady("$('#newUser').bind('click', function openWindow(e){ $('#CreateWindow').data('tWindow').center().open().refresh();})")
.OnDocumentReady("$('#editUser').bind('click', function openWindow(e){$('#EditWindow').data('tWindow').center().open()>refresh();})")
%>
Can you please point me in the right direction as to how to do what I need?
Thank you very much,
Donna