Jul 08, 2010, 6:25 AM
[CLOSED] [1.0] Unable to get values of the Radiogroup CheckedItems inside an usercontrol
Hi,
I am unable to get the checkeditems values of the radiogroup which is placed inside an user control. This is my scenario,
I have an usercontrol "Sample.ascx" which has radiogroup items and using the usercontrol inside an aspx page ("Sample.aspx"). But I am unable to get the values of the checkeditems of the radiogroup..
The CheckedItems.Count is always "0". Below is my samples.
1. Sample.ascx
Thanks
I am unable to get the checkeditems values of the radiogroup which is placed inside an user control. This is my scenario,
I have an usercontrol "Sample.ascx" which has radiogroup items and using the usercontrol inside an aspx page ("Sample.aspx"). But I am unable to get the values of the checkeditems of the radiogroup..
The CheckedItems.Count is always "0". Below is my samples.
1. Sample.ascx
<%@ control language="vb" autoeventwireup="false" codebehind="SampleControl.ascx.vb"
inherits="Zangle.NET.SampleControl" %>
<%@ register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<ext:Panel runat="server" Border="false" Header="true" Title="Select Enrollment Criteria">
<Items>
<ext:Container ID="Container1" runat="server">
<Items>
<ext:RadioGroup ID="rgpEnroll" runat="server" ColumnsNumber="1" Cls="radioBorder">
<Items>
<ext:Radio ID="rdbtnActive" runat="server" BoxLabel="Active Students" Checked="true">
</ext:Radio>
<ext:Radio ID="rdbtnThisYear" runat="server" BoxLabel="This Year Students">
</ext:Radio>
<ext:Radio ID="rdbtnFuture" runat="server" BoxLabel="Future Students">
</ext:Radio>
<ext:Radio ID="rdbtnInActive" runat="server" BoxLabel="Inactive Students">
</ext:Radio>
<ext:Radio ID="rdbtnAll" runat="server" BoxLabel="All Students" Visible="false">
</ext:Radio>
</Items>
</ext:RadioGroup>
</Items>
</ext:Container>
<ext:Checkbox runat="server" ID="chkExPart" BoxLabel="Exclude Part-time Students">
</ext:Checkbox>
</Items>
<Buttons>
<ext:Button runat="server" ID="btnDone" Text="Select">
<DirectEvents>
<Click OnEvent="SaveClick">
<EventMask Msg="Saving..." ShowMask="true" />
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:Panel>
2. Sample.ascx.vbImports Ext.Net
Partial Public Class SampleControl Inherits System.Web.UI.UserControl
<DirectMethod()> _
Public Sub SaveClick()
If (rgpEnroll.CheckedItems.Count > 0) Then
If rdbtnActive.Checked Then
'do something
End If
If rdbtnThisYear.Checked Then
'do something
End If
End If
End Sub
End Class
3. Sample.aspx<%@ page language="vb" autoeventwireup="false" codebehind="Sample1.aspx.vb" inherits="Zangle.NET.Sample1" %>
<%@ register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<%@ register src="SampleControl.ascx" tagname="SampleControl" tagprefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="RMSearch" runat="server" InitScriptMode="Linked" />
<ext:Panel runat="server" ID="pnlCritCtrl" Height="295" Width="480" Frame="false"
StyleSpec="margin-left:5px;margin-right:5px;" Border="true">
<Content>
<uc2:SampleControl ID="SampleControl1" runat="server" />
</Content>
</ext:Panel>
</form>
</body>
</html>
Can you tell us, what is wrong with our code..Thanks
Last edited by geoffrey.mcgill; Jul 08, 2010 at 6:03 PM.
Reason: Formatted users code sample to improve readability