Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Handling checkboxes in Repeater Control

Reply
Thread Tools

Handling checkboxes in Repeater Control

 
 
Imran Aziz
Guest
Posts: n/a
 
      08-06-2005
Hello All,
I have added html checkboxes in each row of the repeater control that I
draw on the page. Now when I want to find out if the check boxes have been
checked or not, I cannot seem to access them. Can anyone please guide me how
to access child items in a repeater control.

Here is my code.

<ASP:Repeater id="lstOtherRepeater" runat="server" >

<HeaderTemplate>

<Table width="100%" >

</HeaderTemplate>

<ItemTemplate>

<tr >

<td>

<input id="chkChannelID" type="checkbox" value="<%#
DataBinder.Eval(Container.DataItem, "nChannelID") %>"/><a
href="showitems.aspx?nChannelID=<%# DataBinder.Eval(Container.DataItem,
"nChannelID") %>" ><%# DataBinder.Eval(Container.DataItem, "sChannelTitle")
%></a>

</td>

</tr>

<tr >

<td>

<%# DataBinder.Eval(Container.DataItem, "sChannelDescription")%>

</td>

</tr>

</ItemTemplate>

<FooterTemplate>

</Table>

</FooterTemplate>

</ASP:Repeater>

How can access the checkboxes in my code behind.

Thanks a lot.


Imran.



 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      08-06-2005
foreach(RepeaterItem i in lstOtherRepeater.Items)
{
HtmlInputCheckBox c = i.FindControl("chkChannelID") as HtmlInputCheckBox;
if (c != null)
{
bool b = c.Checked;
}
}

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Hello All,
> I have added html checkboxes in each row of the repeater control
> that I
> draw on the page. Now when I want to find out if the check boxes have
> been
> checked or not, I cannot seem to access them. Can anyone please guide
> me how to access child items in a repeater control.
>
> Here is my code.
>
> <ASP:Repeater id="lstOtherRepeater" runat="server" >
>
> <HeaderTemplate>
>
> <Table width="100%" >
>
> </HeaderTemplate>
>
> <ItemTemplate>
>
> <tr >
>
> <td>
>
> <input id="chkChannelID" type="checkbox" value="<%#
> DataBinder.Eval(Container.DataItem, "nChannelID") %>"/><a
> href="showitems.aspx?nChannelID=<%#
> DataBinder.Eval(Container.DataItem, "nChannelID") %>" ><%#
> DataBinder.Eval(Container.DataItem, "sChannelTitle") %></a>
>
> </td>
>
> </tr>
>
> <tr >
>
> <td>
>
> <%# DataBinder.Eval(Container.DataItem, "sChannelDescription")%>
>
> </td>
>
> </tr>
>
> </ItemTemplate>
>
> <FooterTemplate>
>
> </Table>
>
> </FooterTemplate>
>
> </ASP:Repeater>
>
> How can access the checkboxes in my code behind.
>
> Thanks a lot.
>
> Imran.
>




 
Reply With Quote
 
 
 
 
Imran Aziz
Guest
Posts: n/a
 
      08-08-2005
thanks a lot Brock, that sorted out my problem
Imran.
"Brock Allen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> foreach(RepeaterItem i in lstOtherRepeater.Items)
> {
> HtmlInputCheckBox c = i.FindControl("chkChannelID") as
> HtmlInputCheckBox;
> if (c != null)
> {
> bool b = c.Checked;
> }
> }
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
>> Hello All,
>> I have added html checkboxes in each row of the repeater control
>> that I
>> draw on the page. Now when I want to find out if the check boxes have
>> been
>> checked or not, I cannot seem to access them. Can anyone please guide
>> me how to access child items in a repeater control.
>>
>> Here is my code.
>>
>> <ASP:Repeater id="lstOtherRepeater" runat="server" >
>>
>> <HeaderTemplate>
>>
>> <Table width="100%" >
>>
>> </HeaderTemplate>
>>
>> <ItemTemplate>
>>
>> <tr >
>>
>> <td>
>>
>> <input id="chkChannelID" type="checkbox" value="<%#
>> DataBinder.Eval(Container.DataItem, "nChannelID") %>"/><a
>> href="showitems.aspx?nChannelID=<%#
>> DataBinder.Eval(Container.DataItem, "nChannelID") %>" ><%#
>> DataBinder.Eval(Container.DataItem, "sChannelTitle") %></a>
>>
>> </td>
>>
>> </tr>
>>
>> <tr >
>>
>> <td>
>>
>> <%# DataBinder.Eval(Container.DataItem, "sChannelDescription")%>
>>
>> </td>
>>
>> </tr>
>>
>> </ItemTemplate>
>>
>> <FooterTemplate>
>>
>> </Table>
>>
>> </FooterTemplate>
>>
>> </ASP:Repeater>
>>
>> How can access the checkboxes in my code behind.
>>
>> Thanks a lot.
>>
>> Imran.
>>

>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeater control and checkboxes Roshawn Dawson ASP .Net Web Controls 0 08-17-2005 02:14 PM
Accessing Checkboxes in Repeater control Imran Aziz ASP .Net 2 08-08-2005 02:16 PM
Cannot select checkboxes in checkboxlist within repeater. Ratman ASP .Net 2 07-04-2004 02:17 AM
Repeater with Checkboxes, handling CheckedChanged event? Per Salmi ASP .Net Web Controls 3 02-26-2004 01:01 AM
Can anyone provide a good example of using checkboxes in a repeater Mark ASP .Net 3 02-03-2004 02:27 PM



Advertisments