CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > general_asp.net.getting_started Tags:
Item Type: Date Entered: 2/10/2004 3:52:53 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 4 Views: 47 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
"lewy2000" <>
NewsGroup User
Using FindbyValue (C#)2/10/2004 3:52:53 PM

0

Hey all,

I'm trying to select an item in a drop-down list if it matches a value in a database. Quite simple, eh? Not for this newbie.

Here's my code:

UpdateStatusID.FindByValue("data_from_query_here").selected = true;


Here's the form:

<asp:DropDownList
ID="UpdateStatusID"
DataTextField="status_name"
DataValueField="status_id"
runat="server" />

Any hints?
"hits.net" <>
NewsGroup User
Re: Using FindbyValue (C#)2/10/2004 4:18:12 PM

0

ListItem l_obj_ListItem=null;
l_obj_ListItem = UpdateStatusID.FindByValue("data_from_query_here");
if(l_obj_ListItem != null)
{
Combo.ClearSelection();
l_obj_ListItem.Selected = true;
}

Hope it helps
"hemant verma"
NewsGroup User
Re: Using FindbyValue (C#)2/10/2004 4:21:07 PM

0


try first find selected index
Hemant
hi_hemant@@@hotmail.comNOSPAM
"lewy2000" <>
NewsGroup User
Re: Using FindbyValue (C#)2/10/2004 5:15:54 PM

0

Thanks for the attempt, but there's a problem with this line:

l_obj_ListItem = UpdateStatusID.FindByValue("task_id");

It throws:

CS0117: 'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'FindByValue'

Keep trying, though!
"mychucky" <>
NewsGroup User
Re: Using FindbyValue (C#)1/30/2007 6:44:31 PM

0

I think the following will work:

ddlStartDateMonth.ClearSelection();

ddlStartDateMonth.Items.FindByValue(Convert.ToString(dr["expStartDateMonth"])).Selected = true;

Except at the moment, I do have my own other code issues.

 

5 Items, 1 Pages 1 |< << Go >> >|


Free Download:













disable asp drop down in javascript

how to create textboxes dynamically?

status of application process

refresh page and keep text

tab controls in express edition? or?

yesterday's date

open source full website

the strangest thing is happening?

ispostback...

preserve line break in an xml file

webrequest protocolversion

code in one line

asp.net 2.0 listbox problem

ie frameset locking on file download

how to find the current browser settings

problem with insert on a button click

date validation allowing - 7/16 or 7/16/04

increment a date

datagrid ... highlight/select row problem

why does this never work?

assign data to other controls after select value from dropdownlist

web server ?

search range

visual web developer 2005

system.io.file

do an update inside a datareader?

get the reversed dns

online payment using asp.net

working with dataviews

return statement

asp.net (vb) page to produce an outlook meeting request (mime email route?)

format filesize in kb or mb

declaring session in class file

lower quality mp3 file?

custom navigation pages control. how to?

whois

"tags" - tagging forum threads, blogs, etc.

calendar/schedule control

connecting to local server

recordcout

<urgent>someone please help..

enabling a login screen for a remote location

looking for shopping cart advice

hyperlinkcolumn

gridview question

displaying data on the page

option strict

how to maintain scroll position

opening files from a web form

using getnextid method

   
  Privacy | Contact Us
All Times Are GMT