473,396 Members | 2,111 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.

Issue Grabbing the value of a drop down list on an asp.net DataGri

Here's my code to replace the DataGrid Header that's automatically generated.
I have another sub that I'm trying to get contents/index of this drop
down(First Name...1...)
I dont know how to get at that, can anyone help me, I was thinking something
along this line..
'TextBox2.Text = DataGrid1.Controls(0).IndexOf
'TextBox2.Text = DataGrid1.Items(0).ItemIndex.ToString
'TextBox2.Text = DataGrid1.Controls(0).FindControl(col1.SelectedInd ex)
????
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.Header Then
Dim col1 As New DropDownList()
col1.Items.Add("")
col1.Items.Add("First Name")
col1.Items.Add("Middle Initial")
col1.Items.Add("Last Name")
col1.Items.Add("City")
col1.Items.Add("State")
col1.Items.Add("Zip Code")
col1.Items.Add("Phone")

' Create a new cell
Dim fcell1 As New TableCell()

' Add the Drop Down to the new table cell
fcell1.Controls.Add(col1)

' Create a new header object
Dim dgItemHeader As New DataGridItem(0, 0, ListItemType.Header)
Dim dgItemOldHeader As DataGridItem
'Create an instance of the header
'from the current header object
dgItemOldHeader = e.Item
' Delete the existing header
DataGrid1.Controls(0).Controls.Remove(dgItemOldHea der)
' Add the cell to the header
dgItemHeader.Cells.Add(fcell1)

' Add the header to the datagrid
DataGrid1.Controls(0).Controls.Add(dgItemHeader)
End If

End Sub
Aug 26 '05 #1
0 980

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

Similar topics

3
by: Martin | last post by:
Hi Guys, I am a bit of a JavaScript rookie, so please bear with me .... Some time ago, I asked for help with some code to populate a drop down country box based on a value I was returning from...
1
by: Dan | last post by:
This is one that has me stumped and I need an expert's input. Any ideas why the values from the second script-generated drop down list isn't recognized by the script to add time values to the...
2
by: Rob Venable | last post by:
I've populated a drop down list from a sql query and the drop down list (select box) looks fine. The issue is... I need to show a blank entry at the top of the select box. In asp I would just add...
4
by: Martyn Fewtrell | last post by:
I want to update a database record with a number of fields - doesn't sound to difficult at this stage! I have a system to select the correct record from the database and load the data into a...
0
by: Mike M | last post by:
Here's my code to replace the DataGrid Header that's automatically generated. I have another sub that I'm trying to get contents/index of this drop down(First Name...1...) I dont know how to get...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: weiwei | last post by:
Hi here is my scenario, I create a drop down list in itemtemplate.(that drop down is created from db), after user click edit command, my ideal plan is have another drop down list in...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
1
Chrisjc
by: Chrisjc | last post by:
First off here is the link to my page Link to page I am having an issue passing the "State" value to "dealerlocater.php" page that I have created, I have my index.php which will pull from my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.