Question

I am having an rad grid in asp.net web site. I am just a beginner to use rad Grid. I have binded grid like this .

  <telerik:RadGrid ID="RadGrid1" runat="server">
        <MasterTableView>
            <Columns>
                <telerik:GridTemplateColumn DataField="Text">
                    <HeaderTemplate>
                        <asp:CheckBox ID="HeaderCheckBox1" runat="server" ClientIDMode="Static" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnCommand="gridCommand" OnRowDataBound="gridRowBound" />
        </ClientSettings>
    </telerik:RadGrid>

now In script I have written something like this but it is not working.

  $(document).ready(function () {
            $('#<%= HeaderCheckBox1.ClientID %>').click(function () {
                alert("Checked");
            });

I have tried a simple method also like

$("#HeaderCheckBox1").click(function(){
});

That too is not working. My Problem is I want to call HTTP Handler on click of this checkbox which is present in header of rad Grid. Please help As soon as possible. Please also clear me the way to call HTTP handle. Althogh there are many examples on internet but still I am confused in the sense that we can call Http handler with post also or only with get.

I have come to know that http handlers return data when you call its url. So, by calling handler with script it would change the url also?

And Rad Grid Only supports Asp.net server controls like If I am trying to add simple html input type then also it is giving error. Like

<input type="checkbox" id="blabla"/>.

Please help me

Was it helpful?

Solution

   $(document).ready(function () {
        $("#<%=RadGrid1.ClientID%> input[id*="HeaderCheckBox1"]:checkbox").click(function () {
           // write code http handler 
            alert("Checked");
        });

Then write code for calling the http handler for more info go through following link http://brijbhushan.net/2011/05/29/call-httphandler-from-jquery-pass-data-and-retrieve-in-json-format/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top