468,272 Members | 1,984 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

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 1118
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 discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.