Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in repeater control , i am selecting certain values using checkbox,how to bring the selected values to the datatable .
Posted
Updated 2-May-12 22:13pm
v2
Comments
Sandeep Mewara 3-May-12 4:50am    
Not clear. "selected values to datatable'?
Member 8405530 3-May-12 5:15am    
in repeatercontrol i am having checkbox in each row,using checkbox i am selecting some item n the repeatercontrol..the selected item should be converted into PDF file.PLease help me.....

1 solution

Try something like:

HTML:
XML
<asp:repeater id="rlist" runat="server">
  <ItemTemplate>
    <asp:CheckBox ID="chkboxSelection" Checked=true Runat="server" Enabled="true"></asp:CheckBox>
    <asp:Label ID="hdnStoreID" Visible="false" Text='<%#DataBinder.Eval(Container.DataItem, "SomeText") %>' runat=server></asp:Label>
  </ItemTemplate>
</asp:repeater>

Code behind:
C#
RepeaterItemCollection rc = rlist.Items;

foreach (RepeaterItem Item in rc) {
	CheckBox myCheckBox = (CheckBox)Item.FindControl("chkboxSelection");
	if (myCheckBox.Checked == true) {
		strJobID = ((Label)Item.FindControl("hdnStoreID")).Text;
		// Do whatever you like with this text now
	}
}
 
Share this answer
 
Comments
Member 8405530 3-May-12 7:52am    
thanks alot
Sandeep Mewara 3-May-12 8:01am    
Welcome.
Espen Harlinn 3-May-12 7:54am    
Nice answer :-D
Sandeep Mewara 3-May-12 8:02am    
Thanks.
Member 8405530 3-May-12 8:19am    
hi sandeep

in am getting error as
cannot implicity convert the type 'System.web.UI.Webcontrols.Label' to a string .......
wat is the error ...Please help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900