what i need actually get value of id that have checkbox checked
i need to modify this line to get id value from repeater
string Id = gvr.Items[id].ToString();// here is issue
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I working on asp.net web forms. I can't get value of id inside repeater control.
i need to get id when loop within repeater control
string Id = gvr.Items[5].ToString();
what I do within code is :
1- click on print button to update status column on database based on id if checkbox checked
2- then after that will loop within repeater control to get checkbox value have checked true
3-get id from repeater and update on database column status with true when checkbox checked is true .
what I try as below :
protected void Print_Click(object sender, EventArgs e)
{
int counter = 0;
foreach (RepeaterItem gvr in repPSStatus.Items)
{
if (((System.Web.UI.WebControls.CheckBox)gvr.FindControl("chkSel")).Checked == true)
{
string Id = gvr.Items[5].ToString();// here is issue
string msg = busiObj.updatestatus(Id);
if (msg == "SUCCESS")
{
counter = counter + 1;
}
}
}
}
and on reprint.aspx page
<thead>
</thead>
<tbody>
<asp:Repeater runat="server" ID="repPSStatus">
<ItemTemplate>
</ItemTemplate>
</asp:Repeater>
</tbody>
what i need actually get value of id that have checkbox checked
i need to modify this line to get id value from repeater
string Id = gvr.Items[id].ToString();// here is issue
Your code do not show what is inside Repeater, we have no idea what is inside, it can have just a control or a bunch of nested controls.
Best I can suggest (following AgaveJoe), is use FindControl as you made to get Checkbox.Checked.
Use grv.Items[5].FindControl(<place control ID here>)
Hi @Ahmed Salah Abed Elaziz,
I see you have marked this post. Glad your issue has been resolved.