473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Datagrid Dropdown Problems....

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("s trConn"))
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>
Nov 18 '05 #1
1 1047
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.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com

"Tim::.." <myatix_at_hotmail.com> wrote in message
news:71**********************************@microsof t.com...
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("s trConn"))
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>

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kilic Beg via .NET 247 | last post by:
Hi, I am having trouble adding a dropdown to DataGrid at runtime. I create all boundColumns and the TemplateColumn for the dropdown at runtime. The dropdown has a different datasource then the...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
4
by: Richard Roche | last post by:
Is it possible to use a drop combo instead of a text box when using the EditCommand in the Datagrid? Many table columns are bound to 'lookup' tables, user's don't care about the foreign keys,...
1
by: Vijay Kerji | last post by:
Hi, I have a datagrid with dropdown list and Remove hyperlink in it as columns. When I remove a row from the datagrid, Dropdown list selection is retaining its previous value. i.e, removed...
6
by: Jenna Alten | last post by:
I have a datagrid with a template column that contains a dropdown list. I currently fill and display the dropdown list on the page load. This is working correctly. I am NOT using an Edit Column. I...
0
by: Sean | last post by:
Hi, I am trying to get this piece of code to work. I have to design a GUI which would look similar to Month |Year |Old | New dropdown |dropdown |4 | dropdown dropdown |dropdown |2 |...
1
by: Michael Kolias | last post by:
Hi everybody, I am having a problem getting the selected value of a drop down list that is populated dynamically inside a datagrid control. When I try to access the selected item on the...
2
by: Peter | last post by:
ASP.NET 2003 In the DataGrid how do I select current cell value in the dropdown box when I click on the edit link, currently when I click on the edit link in the DataGrid the dropdown box...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
4
by: youvrajasnsm | last post by:
Hi All, >I am using datagrid control in asp.net with C#. >I have two dropdown list in datagrid e.g. one dropdown have Classname and another have Studentname. >now I want to show all the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.