I search on google but i can't find the solution.e.Rows or e.row not working in my visual studio 2010.How can i get this property.I want that when i click on "edit" button then gridview have different columsn and one column name is "Data Type" then this column fill with "dropdownlist" and i select value from drop down list.My dropdown control id is "dropdownlist1" .How can i do it?.Here is my code "gridview edit" event code:
protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)
{
DataTable t = (DataTable)Session["MyDataTable"];
GridView2.EditIndex = e.NewEditIndex;
DropDownList ddlName =
(DropDownList)e.Row.FindControl("dropdownlist1"); // HERE IS ERROR AT "Row"
ddlName.DataTextField = "Data Type";
ddlName.DataValueField = "Data Type";
GridView2.DataSource = t;
GridView2.DataBind();
}
Here is my aspx code :
<asp:GridView ID="GridView2" runat="server" AutoGenerateDeleteButton="True"
AutoGenerateEditButton="True" BackColor="#DEBA84" BorderColor="#DEBA84"
BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"
ShowHeaderWhenEmpty="True" onrowcancelingedit="GridView2_RowCancelingEdit"
onrowdeleting="GridView2_RowDeleting" onrowediting="GridView2_RowEditing"
onrowupdating="GridView2_RowUpdating" AutoGenerateColumns="False"
Width="92px">
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FFF1D4" />
<SortedAscendingHeaderStyle BackColor="#B95C30" />
<SortedDescendingCellStyle BackColor="#F1E5CE" />
<SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>
</div>
<asp:TextBox ID="TextBox1" runat="server" Width="137px"></asp:TextBox>
<asp:DropDownList ID="DropDownList1" runat="server" Height="20px"
onselectedindexchanged="DropDownList1_SelectedIndexChanged" Width="140px">
<asp:ListItem>int</asp:ListItem>
<asp:ListItem>Varchar</asp:ListItem>
</asp:DropDownList>
<asp:CheckBox ID="Null" runat="server" />
<asp:CheckBox ID="Primary" runat="server" />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Insert"
style="margin-left: 59px" Width="56px" />
<asp:Button ID="Button2" runat="server" Height="33px" style="margin-left: 76px"
Text="Create Table" Width="94px" />
Is I'm on the right way?or how can i do it?And also tell me how can i update the gridview row.I insert values in gridview manually.There is no database connectivity etc.Thanks
e.Row??