Datagrid Dropdown Problems....

  • Thread starter Thread starter Guest
  • Start date Start date
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:DropDownList id="add_Office" runat="server"></asp:DropDownList>
</FooterTemplate>
</asp:TemplateColumn>
 
It'd be helpful if you posted the code that made the call into your method.

It looks to me like you are not calling the method correctly. You have a
method here that requires 2 parameters. If you're calling it with something
like:

PopulateDropDown(add_Office)

then that would be your problem. You are not passing it the 2nd parameter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top