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

how to use string variable to for datalist name to bind with

I have the following
1. string[] tabname={"xx", "yy"}
2. two datalist in my .aspx page named xx and yy
3. in my .cs page inside page_load() the following line

string name = tabname[0];

name.DataSource = reader
name.DataBind();

I get an error indicating that name is not representing any datalist.
I guess some how I need to tell it that name is not only a variable
it is a existing data list in the .aspx file.

any idea how to do it.

Thanks

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 15 '05 #1
1 1204
Hi nnet,

I guess you need to probably store the DataList instances
in a hashtable that are indexed by the names, for
example 'xx' and 'yy' in your example.
Based on the name, you can then obtain the desired DataList
instance from the Hashtable and call its methods/properties.

DataList xx = (DataList)myHashTable["xx"]
xx.DataSource = ...;
xx.DataBind();

Regards,
Aravind C
"nnet" <na***@hotmail-dot-com.no-spam.invalid> wrote in message
news:3f********@127.0.0.1...
I have the following
1. string[] tabname={"xx", "yy"}
2. two datalist in my .aspx page named xx and yy
3. in my .cs page inside page_load() the following line

string name = tabname[0];

name.DataSource = reader
name.DataBind();

I get an error indicating that name is not representing any datalist.
I guess some how I need to tell it that name is not only a variable
it is a existing data list in the .aspx file.

any idea how to do it.

Thanks

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Nov 15 '05 #2

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

Similar topics

10
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
3
by: Mirek Endys | last post by:
I have DataList as part of DataList item. DataList in DataList. The parent DataList working well including Edit command, that shows Edit template and correctly bind the data into edit template...
0
by: jason | last post by:
In vs.net 2005, is there any way to bind a datalist to a method returning an xml string like this one? public static string Gogetit(string name) { string conn = "Data...
1
by: David C | last post by:
I have a DataList that displays photos and is bound to a list of files. Is there a way to combine the value of a variable (strpath) with the # Bind(...) in the ImageURL field. Below is what I...
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?
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
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...
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,...

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.