i am not found ig:TemplateDataField <asp:CheckBox ID="CheckBox2" runat="server" ClientIDMode="AutoID" />
value =1 or 0 or true or false.
Please help me .
foreach (GridRecord row in listWebGrid.Rows){
string itm = row.Items[0].text;
}
please help as soon as possible.
thanks
i want to check server side to save value in db
The following threads contain most of the possible case scenarios with the use of CheckBox fields in WDG. Please notice, some of the forum threads have samples attachments available as well:
- Capture checkbox checkedchange event from webdatagrid template coloumn- Checkbox in WebDataGrid- Or using ig:BoundCheckBoxField as for example here:http://es.infragistics.com/samples/aspnet/data-grid/checkbox-column- In case you are using EditTemplate: How get value of checkbox from Edit Template
-What is more, in case you could use the unbound column in you app, you could consider the use of checkboxes with Boolean values as implemented here:http://es.infragistics.com/samples/aspnet/data-grid/unbound-checkbox-column
I believe the above will help you achieve your requirements.
Hey, i have same exact code on the page, is not returning any value for the checkbox or returning null for this
design page:
<IGGC:TemplateDataField Header-Text="" Width="30" Key="Asd"> <ItemTemplate> <asp:CheckBox CssClass="tac" ID="CheckBox1" runat="server" AutoPostBack="True" /></ItemTemplate>
checking this code:
CheckBox cb = (CheckBox)gr.Items.FindItemByKey("Asd").FindControl("CheckBox1");
this is returning null value, any idea or input please?
I think u do't know about EnsureTemplates without call of this method, we never find any template field check box
listWebGrid.DataSource = ((DataTable)ViewState["voidCertDataSet"]); listWebGrid.EnsureTemplates();
by
CheckBox chkbx = row.Items[0].FindControl("IsSelected") as CheckBox;
ok fine for help
this is solution.
Hello,
It is not clear for me how many CheckBoxes you are using. string itm = row.Items[0].text will not return what you would expect.
However, if what you would like to get is the checked status of the checkBoxes when using TemplateDataField and ItemTemplate, you could find these template controls at the server using the following approach. You could use the checkBox.Checked status and set the values in the DB as true-false, 0-1 or 1-2 or else based on the logic required.Lets say you have the following markup
<ig:TemplateDataField Key="Asd"> <ItemTemplate><asp:CheckBox runat="server" ID="CheckBox1" Checked="true" OnCheckedChanged="CheckBox1_CheckedChanged" AutoPostBack="true" ClientIDMode="AutoID"/> </ItemTemplate>/ig:TemplateDataField>
And in code behind you could access all checkboxes iterating each row and find the checked status:
if (IsPostBack)
{ foreach (GridRecord row in WebDataGrid1.Rows)
{ CheckBox checkBox= (CheckBox)row.Items.FindItemByKey("Asd").FindControl("CheckBox1"); bool isChecked = checkBox.Checked; } }
In case you would like to do PostBack immediately after a checkbox status is changed/clicked, you could handle OnCheckedChanged="CheckBox1_CheckedChanged for example. protected void CheckBox1_CheckedChanged(object sender, EventArgs e) { CheckBox checkBox = (CheckBox)sender; bool isChecked = checkBox.Checked; }
thnaks for support but
in want to find template column on value for each loop to save multiple value on server side
if check box is check then save values.
check box have two or more check box checked on grid option
1 -checkbox1 =check
2 -checkbox1=check
i want to save two rows value.