开发者

Asp.net 2.0 Gridview edit

开发者 https://www.devze.com 2023-02-22 14:30 出处:网络
i have used grid view to display开发者_JAVA技巧 data. Now i need to edit the row. I have kept edit link button in template field of grid-view. Now when i click the edit button, i need to retrieve the

i have used grid view to display开发者_JAVA技巧 data. Now i need to edit the row. I have kept edit link button in template field of grid-view. Now when i click the edit button, i need to retrieve the data for particular row into the server controls, so that user can enter the data into it.

How can i do that?

let me know if any info required..

thanks!

UPDATED

See http://img18.imageshack.us/i/editform.jpg/

Now, when i click edit from below grid, the data in grid should come up in above form.


There is a different template available in Gridview and you have to use it properly. For example, if you want to edit something, the editTemplate is available for that.. look at the following sample:

   <asp:GridView runat="server" ID="grd">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lbl"></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox runat="server" ID="Textbox1"></asp:TextBox>
                        <asp:HiddenField runat="server" ID="hdf" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox runat="server" ID="Textbox1"></asp:TextBox>
                        <asp:HiddenField runat="server" ID="hdf" />
                    </InsertItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

have a look on these article

http://www.asp.net/data-access/tutorials/using-templatefields-in-the-gridview-control-cs

http://programming.top54u.com/post/ASP-Net-GridView-Edit-ItemTemplate-Mode.aspx


This is such a general question that you should really review how the GridView works in the first place.

Try reviewing the following example from MSDN regarding GridView editting;

http://msdn.microsoft.com/en-us/library/ms972948.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号