Click here to Skip to main content
16,017,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<asp:GridView ID="grid_projectscredit" runat="server" AutoGenerateColumns="false" Width="100%"
                  ShowHeader="true" GridLines="Horizontal">
        <columns>
            <asp:templatefield >
                <itemtemplate>
                        <div>
                            <label></label>
                        </div>
                </itemtemplate>
            </asp:templatefield>
            <asp:templatefield >
                <itemtemplate>
                        <div>
                            <input  type="text"    />
                        </div>
                </itemtemplate>
            </asp:templatefield>
            <asp:templatefield >
                <itemtemplate>
                        <div>
                            <input type="text"  />
                        </div>
                        <div>
                            <input type="text"  />
                        </div>
                    </div>
                </itemtemplate>
            </asp:templatefield>
            <asp:templatefield >
                <itemtemplate>
                        <div>
                            <input type="text"  />
                        </div>
                        <div>
                            <input type="text"   />
                        </div>
                        <div>
                            <input type="text"   />
                        </div>
                        <div>
                            <input type="text"   />
                        </div>
                </itemtemplate>
            </asp:templatefield>
            <asp:templatefield >
                <itemtemplate>
                    <div>
                        <input type="text"  />
                    </div>
                </itemtemplate>
            </asp:templatefield>
            <asp:templatefield >
                <itemtemplate>
                    <div>
                        <input type="text"  />
                    </div>
                </itemtemplate>
            </asp:templatefield>
            <asp:templatefield >
                <itemtemplate>
                    <div>
                        <input type="text" readonly  />
                    </div>
                </itemtemplate>
            </asp:templatefield>
        </columns>
    </asp:GridView>



How to add data to gridview template using jquery ? i knew how to bind server side.. I need to knw that how to bind data using jquery
Posted
Updated 13-Aug-15 0:12am
v2

1 solution

"Binding" is server side.

The actual control will take the data from the source and write out the html during the controls "RenderChildren(HtmlWriter writer)" method.

If you want to perform this client-side, then you will have to replicate the effect.

Take a look at the html source on the page when the datasource is bound at the server. Either create a template and / or a method that writes the html to a var in javascript, then remove the existing data and append the new rows you have written.

An alternative is to use an UpdatePanel. It will allow the grid to be rendered at the server with the bound datasource, but it using AJAX web methods to write the data back onto the page. It's a much simpler solution.

This article should be enough to get you started with an UpdatePanel:

How to enable partial rendering with the AJAX UpdatePanel[^]
 
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