Link to home
Start Free TrialLog in
Avatar of newjeep19
newjeep19Flag for United States of America

asked on

How to edit a asp.net gridview row.

I need to know how to edit a asp.net gridview row when it has been uploaded from an excel spreadsheet but has not been saved to a SQL database. I want to give the option to the user to edit and delete rows in the gridview table after they have uploaded the table from excel file before they submit the gridview to the SQL database.
Please help.
Thank you,
SOLUTION
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of newjeep19

ASKER

My asp.net gridview is dynamic see the code below:
<asp:GridView ID="gvNew" runat="server"
                                OnSelectedIndexChanged="gvNew_SelectedIndexChanged"
                                OnRowEditing="EditCustomer"
                                OnRowUpdating="UpdateScoreCard"
                                OnRowCommand="gvGetExsistingPromo_RowCommand"
                                ShowFooter="true"
                                OnRowCancelingEdit="CancelEdit">
                                <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                                <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                                <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                                <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" Height="75px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                <AlternatingRowStyle BackColor="#F7F7F7" />
                                <Columns>
                                    <%--<asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="150" />
                                    <asp:BoundField DataField="Country" HeaderText="Country" ItemStyle-Width="150" />--%>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="btnedit" runat="server" CommandName="Edit" ImageUrl="~/images/Edit.png" Width="50px" Visible="true" CommandArgument="<%# Container.DataItemIndex %>" />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                                                                       <asp:ImageButton ID="imgAddBtn" runat="server" Width="50px" ImageUrl="~/images/addfixed.png" OnClientClick="imgAddBtn_Click" />
                                                                                   </EditItemTemplate>
                                    </asp:TemplateField>
                                    <%--<Delete Button>--%>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgDeleteBtn" runat="server" Width="50px" ImageUrl="~/images/Delete.png" OnClientClick="return confirm('Do you want to delete?')" CausesValidation="False" CommandName="Delete" Visible="true" ToolTip="Send an email to the course attendees"></asp:ImageButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>

Open in new window

Any thoughts on this? Please help!
SOLUTION
Avatar of jitendra patil
jitendra patil
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found a way using asp.net place holder.