Click here to Skip to main content
15,946,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have problem with edit date in gridview.When I edit gridview i want update one of cell. So enter new value in this cell, and problem is that i don't have any idea how can i download this new value because than i write:

I download old value not new.
Can someone help me ?


This link didn't help i still have this problem.
I change text box to dropdown list but i have still this problem.
Now i have something like tihs :
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                        <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                            SortExpression="ID" />
                                    <asp:Label ID="Teacher_name" runat="server" Text='<%# Eval("Teacher_name") %>'></asp:Label>
                                    <asp:DropDownList ID="ddlEditTeacher" runat="server" 
                                        DataSourceID="SqlDataSource1" DataTextField="Teacher_name"  
                                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:DiaryConnectionString %>" 
                                        SelectCommand="SELECT' '+Teachers.surname AS[Teacher_name] FROM Teachers">

but still when i edit item i can use new select values. For example if drop down list have to values "A" and "B". Now in grid view is value "A". When i want change this value, i click on edit and select in drop down list value "B" but in function gv_RowUpdating when i write
GridViewRow row = gvMajor.Rows[e.RowIndex];
                string text=
                ((DropDownList) (row.Cells[3].FindControl(ddlEditTeacher)).SelectedValues;

I have still value "A" not "B" why ?
Updated 12-Dec-11 8:01am
Monjurul Habib 4-Dec-11 13:56pm    
clarify your question.

Share this answer
Maybe this will help DataGridDemo[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900