4 Answers, 1 is accepted
0
Hello Anders,
Could you please elaborate a bit more on your scenario so we can test it locally?
Regards,
Boyan Dimitrov
the Telerik team
Could you please elaborate a bit more on your scenario so we can test it locally?
- Could you provide some information about which templates in your project you are using? Here you can find more information about templates in RadPanelBar control.
- Providing a sample project that demonstrates your scenario (the declaration of the templates and the way you apply them) would be really helpful.
Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
![](/forums/images/avatarimages/default.gif)
Anders
Top achievements
Rank 1
answered on 28 Oct 2012, 07:59 AM
Thanks for your reply.
I want to read the values ​​of all the checkboxes in one postback.
Here is an example:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test_statisk.aspx.vb" Inherits="Test_statisk" %>
<!DOCTYPE html>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
>
</
asp:ScriptReference
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
>
</
asp:ScriptReference
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
>
</
asp:ScriptReference
>
</
Scripts
>
</
telerik:RadScriptManager
>
<
telerik:RadPanelBar
ID
=
"radPanelBar"
Runat
=
"server"
style
=
"margin-right: 117px"
Width
=
"353px"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
"Main 1"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
""
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cb11"
Text
=
"cb11"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelItem
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
"Main 2"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
""
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cb21"
Text
=
"cb21"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
""
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cb22"
Text
=
"cb22"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelItem
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
"Main 3"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
""
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cb11"
Text
=
"cb31"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
""
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cb11"
Text
=
"cb32"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelBar
>
<
br
/>
<
asp:Button
ID
=
"btnShowSelected"
runat
=
"server"
Text
=
"Show selected"
/>
<
br
/>
</
div
>
<
asp:Label
ID
=
"lblText"
runat
=
"server"
></
asp:Label
>
</
form
>
</
body
>
</
html
>
Imports
Telerik.Web.UI
Partial
Class
Test_statisk
Inherits
System.Web.UI.Page
Protected
Sub
btnShowSelected_Click(sender
As
Object
, e
As
EventArgs)
Handles
btnShowSelected.Click
For
Each
c
As
RadPanelItem
In
radPanelBar.GetAllItems
For
Each
x
As
Control
In
c.Items
lblText.Text &= x.
GetType
.ToString &
"<br>"
' this only returns "Telerik.Web.UI.RadPanelItem"
Next
Next
End
Sub
End
Class
0
Accepted
Hello Anders,
Please note that your last two CheckBox ID are duplicating the CheckBox ID in the first RadPanelBar.
Their ID values should be as following - cb31 and cb32.
Please use the following approach to achieve the desired functionality:
Hope that this will lead you into the right direction.
Kind regards,
Boyan Dimitrov
the Telerik team
Please note that your last two CheckBox ID are duplicating the CheckBox ID in the first RadPanelBar.
Their ID values should be as following - cb31 and cb32.
Please use the following approach to achieve the desired functionality:
Protected
Sub
btnShowSelected_Click(sender
As
Object
, e
As
EventArgs) Handles
btnShowSelected.Click
Dim
panels
As
IList(Of RadPanelItem) = radPanelBar.GetAllItems()
For
Each
panel
As
RadPanelItem
In
panels
If
panel.Items.Count = 0
Then
Dim
checkBox
As
CheckBox = TryCast(panel.Controls(1), CheckBox)
If
checkBox.Checked =
True
Then
lblText.Text += checkBox.ID
End
If
End
If
Next
End
Sub
Hope that this will lead you into the right direction.
Kind regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
![](/forums/images/avatarimages/default.gif)
Anders
Top achievements
Rank 1
answered on 29 Oct 2012, 04:15 PM
Yes, thank you very much!
Sincerely
// Anders
Sincerely
// Anders