rito1
asked on
Updating Multiple Gridview Rows Simultaneously
Hi All
I am looking vor a VB solution that enables me to load a Gridview with all loaded rows to be editable and that can be updated Simultaneously via 1 button click event.
Does anyone know of any?
Rit
I am looking vor a VB solution that enables me to load a Gridview with all loaded rows to be editable and that can be updated Simultaneously via 1 button click event.
Does anyone know of any?
Rit
ASKER
thanks cmhunty,
Please could you share with me which event I would use to perform the update action and also an example of how to iterate thru the rows of the gridview?
many thanks
Rit
Please could you share with me which event I would use to perform the update action and also an example of how to iterate thru the rows of the gridview?
many thanks
Rit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent, thanks cmhunty. I'll give it a try.
Rit
Rit
what if its wasnt a textbox ????? what if it was a dropdownlist
ASKER
Hi trjmkztdg,
Instead of this...
CType(gvr.FindControl("tbF irstName") , TextBox).Text
I believe you would change it to either of these depending on whether you want to obtain the dropdownlist's selected value or selected text...
CType(gvr.FindControl("tbF irstName") , DropDownList).SelectedValu e
CType(gvr.FindControl("tbF irstName") , DropDownList).SelectedItem .Text
Hope this is what you were looking for.
Rit
Instead of this...
CType(gvr.FindControl("tbF
I believe you would change it to either of these depending on whether you want to obtain the dropdownlist's selected value or selected text...
CType(gvr.FindControl("tbF
CType(gvr.FindControl("tbF
Hope this is what you were looking for.
Rit
<asp:TemplateField HeaderText="First Name">
<ItemTemplate>
<asp:TextBox ID="tbFirstName" runat="server" Text='<%# Eval("FirstName") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
Then you'll need to save the primary key against each row - best to do this in the datakeynames of the grid view.
When the update button is pressed, you can iterate through the rows of the gridview and make an update statement based on the values on the text boxes. This can then be executed.