Click here to Skip to main content
15,886,055 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I am trying to use the checkbox control inside the repeater.
On this checkbox control, i am trying to call server side event for validation purpose.

but the call does not go to the server though i have used OnCheckedChanged Event.

I am able to get the client side function call using onClick Event, but server side event is not working.

please help me out.

please reply on my personal id:[removed]@gmail.com.

Waiting for your repy.

Thanking You,
Bhavin Shah.

[Modified: you do not need to provide your email address. When you receive an answer, it will go to the email address you provided to CP.]
Posted
Updated 21-Jun-10 9:20am
v2
Comments
Moak 23-Jun-10 3:52am    
Which programming language? Please add it to the "Tags" field.

1 solution

Hi,

Try the following:

XML
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" >
       <ItemTemplate>
       <asp:CheckBox ID="chk" runat="server" AutoPostBack="true" Text='<%#Bind("CustomerName")%>' OnCheckedChanged="check_changed"/>
       </ItemTemplate>
       </asp:Repeater>



C#
protected void check_changed(object sender, EventArgs e)
    {
        if (sender != null)
        {
            try
            {
                if (((CheckBox)sender).Checked)
                {
                    Response.Write(((CheckBox)sender).Text + " is checked");
                }
            }
            catch { }
        }
    }



Hope this will work. Cheers :thumbsup:
 
Share this answer
 

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