473,406 Members | 2,705 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,406 software developers and data experts.

dropdown selectedvalue won't set

hey all,
can someone please tell me why the following statment doesn't work?

((DropDownList)e.Row.Cells[2].FindControl("DrpSM_Skill_Desc")).SelectedValue=(( DataRowView)e.Row.DataItem)[3];
Cannot implicitly convert type 'object' to 'string'. An explicit conversion
exists (are you missing a cast?)

I'm in the Immediate Window doing this and also the following looks like it
would set a dropdownlist.selectedvalue?

?((DataRowView)e.Row.DataItem)[3]
"Internet"

Thanks,
rodchar
Nov 21 '06 #1
2 3090
Nevermind I think, here's what learned:
((DropDownList)e.Row.Cells[2].FindControl("DrpSM_Skill_Desc")).SelectedValue=(S tring)(((DataRowView)e.Row.DataItem)[3]);

"rodchar" wrote:
hey all,
can someone please tell me why the following statment doesn't work?

((DropDownList)e.Row.Cells[2].FindControl("DrpSM_Skill_Desc")).SelectedValue=(( DataRowView)e.Row.DataItem)[3];
Cannot implicitly convert type 'object' to 'string'. An explicit conversion
exists (are you missing a cast?)

I'm in the Immediate Window doing this and also the following looks like it
would set a dropdownlist.selectedvalue?

?((DataRowView)e.Row.DataItem)[3]
"Internet"

Thanks,
rodchar
Nov 21 '06 #2
emm ... you could also do

((DropDownList)e.Row.Cells[2].FindControl("DrpSM_Skill_Desc")).SelectedValue=(( DataRowView)e.Row.DataItem)[3].ToString();

"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:4B**********************************@microsof t.com...
Nevermind I think, here's what learned:
((DropDownList)e.Row.Cells[2].FindControl("DrpSM_Skill_Desc")).SelectedValue=(S tring)(((DataRowView)e.Row.DataItem)[3]);

"rodchar" wrote:
>hey all,
can someone please tell me why the following statment doesn't work?

((DropDownList)e.Row.Cells[2].FindControl("DrpSM_Skill_Desc")).SelectedValue=(( DataRowView)e.Row.DataItem)[3];
Cannot implicitly convert type 'object' to 'string'. An explicit
conversion
exists (are you missing a cast?)

I'm in the Immediate Window doing this and also the following looks like
it
would set a dropdownlist.selectedvalue?

?((DataRowView)e.Row.DataItem)[3]
"Internet"

Thanks,
rodchar

Nov 21 '06 #3

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

Similar topics

3
by: Steven | last post by:
Hi there, I am having a problem with an ASP.NET DropDown list - whenever I set the SelectedValue (or SelectedIndex) property, when the page displays, only the first item is ever selected. This...
1
by: Andy Sutorius | last post by:
Hi, I have 4 panels, each panel has a dropdown and a "next" button. I would like to get the selected value of the dropdown after the next button is clicked. I thought I could use the following...
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: Steve Pierce | last post by:
I am having some issues with a runtime dropdownlist in a datagrid. The issue is that I cannot get ViewState to fill the selected index of a runtime dropdown properly on postback. I do not want to...
1
by: sck10 | last post by:
Hello, I am using the following in a GridView. Currently, I am using a dropdown that pulls the Name of the person, given the Employee ID. I am doing this in both the ItemTemplate and the...
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...
5
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My...
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...
3
by: John | last post by:
I have two dropdown lists that I have bound to a datatable and set the DataTextField and DataValueField for. Both lists show the values I expect from the database. However, when I need to access...
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.