473,378 Members | 1,378 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,378 software developers and data experts.

Read Value from DropDownList in TemplateColumn?

I am fairly new to ASP.NET, so bear with me...

I have a Datagrid with a data-bound DropDownList in the TemplateColumn. Here
is the HTML code:

<asp:TemplateColumn HeaderText="Void">
<ItemStyle horizontalalign="Left" wrap="False"></ItemStyle>
<ItemTemplate>
<%#Databinder.Eval(Container.DataItem, "isVoid")%>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlIsVoid" Runat="server"
CssClass="ddl100"></asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>

In Edit Mode, the end-user can select either True or False in the
DropDownList, then save those changes. ALL of that is working correctly.

The trouble comes when I try to deal with the value of that Datagrid column
directly. It appears to always equate to String.Empty. Everytime the
Datagrid is displayed, I go through the rows and change the Row forecolor to
Red where the IsVoid column is True.

Private Sub ColorVoidRows(ByVal dg As DataGrid, ByVal vindex As Integer)

For Each item As DataGridItem In dg.Items
If item.Cells(vindex).Text = "True" Then
item.ForeColor = Color.Red
End If
Next
End Sub

This method works on a number of other Datagrid that can be displayed on the
page, but those Datagrids don't have the templated IsVoid column. So, I
figure it must have something to do with that.

The Cells index is working and I have confirmed that I am looking at the
correct column.

My question is how do I retrieve that value from that TemplateColumn when I
am NOT in Edit Mode?

Any help is greatly appreciated.

carl
Jun 8 '06 #1
0 1163

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

Similar topics

5
by: Ronald S. Cook | last post by:
In my ASP.NET DataGrid, I would like to set the "Selected" value of a dropdown list item depending on a condition. While this is easy to do for, say, a textbox, .NET doesn't seem to play as nice...
4
by: Carlo Marchesoni | last post by:
I have an editable Datagrid and some columns (4 and 5) are TemplateColumns (because I have DropDownLists there). Everything works fine except that if I want to retrieve the values (that I can see...
2
by: jason | last post by:
Pardon my ignorance on this. The below code works, except, when I edit a record and update the two drop downs take the first entry in the dropdownlist if not selected. I'd also like the dropdown to...
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...
2
by: Luis Esteban Valencia | last post by:
Hello I have a datagrid with a dropdownlist that has the products, another column has the price of the product and when the user changes the product it also must change the price how can I achieve...
0
by: Luis Esteban Valencia | last post by:
Hello. I have a datagrid with one row. I have a button that adds a new row. I am trying to implement that when the user selects one product it must change the price on the quantity column. Anyway...
0
by: rmccinc | last post by:
I have a dropdownlist in a datagrid and it has autopostback set to true. I need to get the new value of that dropdown to fill a textbox in the same datagrid row. I have set the databind event on...
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...
2
by: Steve Hershoff | last post by:
Hi everyone, I have a DataGrid with several TemplateColumns. One of these columns has an EditItemTemplate that contains an ASP.Net DropDownList. I'm catching this DropDownList's...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.