Sep 01, 2010, 7:10 AM
[CLOSED] V(0.8) How to Read Checkbox Group using C# Code Like Asp CheckGroup Control
Hi,
We using Checkbox group for creating dynamically when page Loads. There is No problem when loading dynamically the Check box group. But When reading the Checkbox Group from Form for Saving into Database it throwing Error. We need to store the Checkbox group values into the String with Split Character. Below is the Code what we are trying to Read:
ASPX PAGE:
We using Checkbox group for creating dynamically when page Loads. There is No problem when loading dynamically the Check box group. But When reading the Checkbox Group from Form for Saving into Database it throwing Error. We need to store the Checkbox group values into the String with Split Character. Below is the Code what we are trying to Read:
ASPX PAGE:
<ext:FieldSet ID="FsetProcessRoute" runat="server" Collapsible="true">
<Body>
<ext:CheckboxGroup ID="ChkProcessRoute" runat="server" ColumnsNumber="5" Vertical="true"
Width="650" EnableViewState="true" LabelSeparator="">
</ext:CheckboxGroup>
</Body>.....
DYNAMIC CREATION ON PAGE LOAD...
DataSet dsGridFunction = new DataSet();
dsGridFunction = objBLLProcess.ProcessInquiryGridBind(objGridBind);
for (int i = 0; i < dsGridFunction.Tables[0].Rows.Count; i++)
{
Checkbox chk = new Checkbox();
chk.ID = dsGridFunction.Tables[0].Rows[i]["ProcessCode"].ToString();
chk.BoxLabel = dsGridFunction.Tables[0].Rows[i]["ProcessName"].ToString();
chk.EnableViewState = false;
ChkProcessRoute.Items.Add(chk);
}
DataSet dsChkProcess = objBLLInquiry.getSelectData(objGridBind);
for (int Counter = 0; Counter < dsChkProcess.Tables[0].Rows.Count; Counter++)
{
if (dsChkProcess.Tables[0].Rows[Counter]["Checked"].ToString() == "1")
{
ChkProcessRoute.Items[Counter].Checked = true;
}
else
{
ChkProcessRoute.Items[Counter].Checked = false;
}
}
........
ERROR WHEN EXECUTING THE FOLLOWING CODE:...
string Lstr = string.Empty;
for (int i = 0; i < ChkProcessRoute.Items.Count; i++)
{
if (ChkProcessRoute.Items[i].Checked == true)
{
Lstr += ChkProcessRoute.Items[i].Value + ",";
}
}
....
Last edited by Daniil; Sep 03, 2010 at 6:27 PM.
Reason: [CLOSED]