Hi, there is no error in your above codes. Please check your markup to make sure “CheckBox1” exists in your repeater. You can also paste your markup here, we will help to check them.
is not modifying the values in each row. // the procedure is called to modify the checked users
verifcation_id to true when button is clicked. how i called the procedure.???
exbond
Member
58 Points
144 Posts
finding control
May 12, 2012 01:53 PM|LINK
how to find a checkbox control in repeater? my code is not working..
protected void Button1_Click(object sender, EventArgs e) { foreach (RepeaterItem i in Repeater1.Items) { CheckBox chb = (CheckBox)i.FindControl("CheckBox1"); if (chb.Checked) { dcdc.modify_request(true); // procedure called; } else { Response.Write("not found in "+i+itration); } }code gives error of : Object reference not set to an instance of an object. the i is not the integer value.
jamshed alam
Member
319 Points
105 Posts
Re: finding control
May 12, 2012 02:23 PM|LINK
protected void Button1_Click(object sender, EventArgs e) {for (int itemCount = 0; itemCount < rptrSubjects.Items.Count; itemCount++) { CheckBox chkBox = ((CheckBox)rptrSubjects.Items[itemCount].FindControl("chkSubjects")); if (chkBox != null && chkBox.Checked == true) { lblStatus.Text = lblStatus.Text + ""+ chkBox.Text; lblStatus.Text = lblStatus.Text + "</br>"; } } }exbond
Member
58 Points
144 Posts
Re: finding control
May 12, 2012 02:41 PM|LINK
not working same error...
MahadTECH
Star
8976 Points
1659 Posts
Re: finding control
May 12, 2012 04:52 PM|LINK
This will help you
Ref :
http://www.dreamincode.net/forums/topic/59065-checkbox-inside-repeater-control/
http://stackoverflow.com/questions/3550234/unable-to-find-control-in-asp-net-repeater-control
http://forums.devshed.com/net-development-87/checkbox-inside-repeater-247211.html (read it first)
Good LucK~~
Mahad Bin Mukhtar
Remember to Mark the replies as Answers
The easiest day was 'yesterday'.
MCP, MCSD
For .NET TECH Blog
Allen Li - M...
Star
10411 Points
1196 Posts
Re: finding control
May 14, 2012 05:34 AM|LINK
Hi, there is no error in your above codes. Please check your markup to make sure “CheckBox1” exists in your repeater. You can also paste your markup here, we will help to check them.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
exbond
Member
58 Points
144 Posts
Re: finding control
May 17, 2012 08:36 AM|LINK
my code is correct then their is problem with the procedure called in the code.
the procedure is not able to modify each row of the repeater.
public DataClassesDataContext dcdc = new DataClassesDataContext(); for (int count = 0; count < Repeater1.Items.Count; count++) { CheckBox chb = ((CheckBox)Repeater1.Items[count].FindControl("CheckBox1")); //CheckBox chb = (CheckBox)i.FindControl("CheckBox1"); // Label lab=(Label)i.FindControl("Label1"); if (chb != null && chb.Checked == true) { dcdc.modify_request(true); } } //repeater1 binded again.the procedured
is not modifying the values in each row. // the procedure is called to modify the checked users verifcation_id to true when button is clicked. how i called the procedure.???
Allen Li - M...
Star
10411 Points
1196 Posts
Re: finding control
May 18, 2012 09:58 AM|LINK
Hi, please set breakpoints to:
and debug the codes to check where the issue occurs. Additionally, please paste your codes (dcdc.modify_request();)here for analysis.If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
sriramabi
Contributor
4351 Points
1277 Posts
Re: finding control
May 18, 2012 10:18 AM|LINK
hai
change u r procedure call methode parameter datatype bool or Boolean
for
Public void modify_request(bool value)
{
//Stored procedure call code
}
thank u