G
Guest
Hi,
Can someone please tell me why this doesn't work! I keep getting an error in
the build saying!
"Argument not specified for parameter 'e' of Public Sub PopulateDropdown..."
I would be really grateful for any help! The dropdownlist is in the footer
of a datagrid and I would like to use it to add and edit records. Thanks for
any help!
...:: CODEBEHIND
Sub PopulateDropdown(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
' Create connection
Dim Myconn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("SelectOffice", Myconn)
cmd.CommandType = CommandType.StoredProcedure
Myconn.Open()
Dim add_Office As DropDownList
add_Office = CType(e.Item.FindControl("add_Office"), DropDownList)
add_Office.DataSource =
cmd.ExecuteReader(CommandBehavior.CloseConnection)
add_Office.DataValueField = "officeID"
add_Office.DataTextField = "offName"
add_Office.DataBind()
Myconn.Close()
End Sub
...:: Datagrid
<asp:TemplateColumn HeaderText="Office">
<ItemTemplate>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="office" Columns="3" Text='<%# Container.DataItem("offName")
%>' Runat="server" />
</EditItemTemplate>
<FooterTemplate>
<!-- Pull Office Names from Database -->
<asp
ropDownList id="add_Office" runat="server"></asp
ropDownList>
</FooterTemplate>
</asp:TemplateColumn>
Can someone please tell me why this doesn't work! I keep getting an error in
the build saying!
"Argument not specified for parameter 'e' of Public Sub PopulateDropdown..."
I would be really grateful for any help! The dropdownlist is in the footer
of a datagrid and I would like to use it to add and edit records. Thanks for
any help!
...:: CODEBEHIND
Sub PopulateDropdown(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
' Create connection
Dim Myconn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("SelectOffice", Myconn)
cmd.CommandType = CommandType.StoredProcedure
Myconn.Open()
Dim add_Office As DropDownList
add_Office = CType(e.Item.FindControl("add_Office"), DropDownList)
add_Office.DataSource =
cmd.ExecuteReader(CommandBehavior.CloseConnection)
add_Office.DataValueField = "officeID"
add_Office.DataTextField = "offName"
add_Office.DataBind()
Myconn.Close()
End Sub
...:: Datagrid
<asp:TemplateColumn HeaderText="Office">
<ItemTemplate>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="office" Columns="3" Text='<%# Container.DataItem("offName")
%>' Runat="server" />
</EditItemTemplate>
<FooterTemplate>
<!-- Pull Office Names from Database -->
<asp
</FooterTemplate>
</asp:TemplateColumn>