[RESOLVED]Hope to redirect or edit the record in GridView for Huge data.

Hello,

          Just need a proper idea how should i implement this kind of stuff in my asp.net C# application, which is retrieving data using GridView.

-> So exactly i have a form which has 500 around fields. (DONE)

-> User fill and save it to sql database. ( DONE )

-> Now, i want to retrieve data from SQLdatabase based on search of the name. (DONE)

-> Then i want user to provide option to edit the record for the result displayed. ( STUCK HERE)

     ->  I am stuck at a point, where i have to edit 500 fields header field. but instead i need a solution to it.

Overall i want user to be redirected to a page on clicking edit option and he can then edit the fields and save it back.

i don’t want to write 500 fields name that sucks.. :(  is there a way to short my work.. :|

I understood the following from ur post.

– You bind data from DB to Gridview.

– But ur problem is , how to edit particular record in Gridview,

My solution is,

Use EditItemTemplate in TemplateField

<asp:Gridview..>

<asp:TemplateField>

    <EditItemTemplate>

                  // Ur control like Textbox, Dropdown…

    </EditItemTemplate>

<asp:TemplateField>

</asp:Gridview>

set AutoGenerateEditButton =true in Gridview Properties.

and then write code for edit and an event edit… in gridview event..

hmm so that will generate Edit option for all 500 fields ? and what if i wanna make some fields as ReadOnly, like timestamp or some same.

you can create ur ASp.net server control within EditItemTemplate. If ur need is readonly, use Label Control . or else ur need is Redirect to another page, use link button . Finally set the properties for these controls like CommandArgument , CommandName.

Leave a Reply