473,396 Members | 1,996 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.

EditItemTemplate - SelectedIndex

Looks like I can just populate dropdownlist using DataView, say
TempDataView, during
my pageload and
then in the aspx file in the EditItemTemplate use something like this:

<EditItemTemplate>
<asp:DropDownList
id = "ddMajor"
runat="server"
DataSource='<%# TempDataView%>'
DataTextField="cd_major"
DataValueField="cd_major"
SelectedIndex='<%#GetMajorDesc((String)DataBinder. Eval(Container.DataItem,
"????????")) %>' />
</EditItemTemplate>

How do i set the Selected Item or index to equal the correct item for this
rows data?

Krish

Nov 17 '05 #1
1 2060
You have several options for this, depending on the information you know, If
you know the value you want to select - i.e. the value of 'cd_major' then
you can use the 'SelectedValue' property of the control and set the value,
If you know the index you can use 'SelectedIndex' and if you have the
ListItem object you can use 'SelectedIndex'

HTH

Ollie Riches

"Krish" <vi***************@GMAIL.com> wrote in message
news:e8*************@TK2MSFTNGP15.phx.gbl...
Looks like I can just populate dropdownlist using DataView, say
TempDataView, during
my pageload and
then in the aspx file in the EditItemTemplate use something like this:

<EditItemTemplate>
<asp:DropDownList
id = "ddMajor"
runat="server"
DataSource='<%# TempDataView%>'
DataTextField="cd_major"
DataValueField="cd_major"
SelectedIndex='<%#GetMajorDesc((String)DataBinder. Eval(Container.DataItem,
"????????")) %>' />
</EditItemTemplate>

How do i set the Selected Item or index to equal the correct item for this
rows data?

Krish

Nov 17 '05 #2

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

Similar topics

2
by: VB Programmer | last post by:
I have a datagrid with a dropdownlist in it. As I understand it, the ItemTemplate section represents the cell when not in edit mode and the EditItemTemplate section represents the cell when in...
1
by: George Durzi | last post by:
When my datagrid is in edit mode, one of my columns is edited using a drop down list. I'm able to bind the DropDownList to a DataSource when in edit mode. HOWEVER, I can't preset the...
0
by: Stuart Shay | last post by:
Hello All I Created a DataList and when the user Selects a Item for Edit, I want to change the CssClass TextBox Properties based on if the Item is a Item or Alternating Item. Item =>...
15
by: NH | last post by:
How can I only display the textbox I have in an EditItemTemplate based on the value in another cell in the row? i.e I only want users to edit one of the cells based on the value in another...
4
by: Dabbler | last post by:
I have two tables I'm editing in a Gridview. The VANS table contains a key to the other LESSOR table. I would like to use a dropdown list to select the LessorId value while displaying the Lessor...
2
by: WT | last post by:
Hello, I can figure how to set selectIndex or Value, I have tried this <EditItemTemplate> <asp:DropdownList ID="DDLSector3" DataSource='<%#...
4
by: Savas Ates | last post by:
I have a datagrid control and in my edit item template tag I have ,
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...
0
by: dch | last post by:
I have a GridView, and when I click Edit, it is firing the OnRowEditing event ,and I am setting the edititem index, but it keeps displaying the ItemTemplate fields instead of the EditItemTemplate. I...
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?
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
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...
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.