PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 5.00 average.

datarow[] array as datasource for RadioButtonList

 
 
Christian H
Guest
Posts: n/a
 
      13th Jul 2003
Hello.

I'm using the getChildRows method, in order to get the records related to my
current record:
DataRow[] myRowArray = dataItem.GetChildRows("myRelation");

Then I add this as a datasource:
RadioButtonList rbl=new RadioButtonList();
rbl.DataSource=myRowArray ;
rbl.DataBind();

My problem is when I want to set rbl.DataTextField property, so that I can
choose which column that should display a string related to the
radiobuttons.

I've tried:
rbl.DataTextField="[0]";
and
rbl.DataTextField="myColumn";

Neither of these works, as I get an error that there is no property with
either of these names.
I'm not sure if it is possible to use a datarow array as a datasource.
I've been struggeling with this for almost a week now, without any luck
finding my answer.

Regards C.H




 
Reply With Quote
 
 
 
 
Rory
Guest
Posts: n/a
 
      14th Jul 2003
I am not sure if this is what you are trying to do, but to
set items in a radionbutton list, you need to loop through
each item individually to set its properties.

eg

Dim lst As ListItem
For Each lst In RadioButtonList1.Items
lst.Selected = True
lst.Text = "Option 1"
lst.Value = 1
Next

for further info:
http://msdn.microsoft.com/library/default.asp
url=/library/en-
us/vbcon/html/vbtsksettingselectioninlistbox.asp

Rory



>-----Original Message-----
>Hello.
>
>I'm using the getChildRows method, in order to get the

records related to my
>current record:
>DataRow[] myRowArray = dataItem.GetChildRows

("myRelation");
>
>Then I add this as a datasource:
>RadioButtonList rbl=new RadioButtonList();
>rbl.DataSource=myRowArray ;
>rbl.DataBind();
>
>My problem is when I want to set rbl.DataTextField

property, so that I can
>choose which column that should display a string related

to the
>radiobuttons.
>
>I've tried:
>rbl.DataTextField="[0]";
>and
>rbl.DataTextField="myColumn";
>
>Neither of these works, as I get an error that there is

no property with
>either of these names.
>I'm not sure if it is possible to use a datarow array as

a datasource.
>I've been struggeling with this for almost a week now,

without any luck
>finding my answer.
>
>Regards C.H
>
>
>
>
>.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
is it possible using a datarow as a binding datasource? (C#) =?iso-8859-1?q?f=E9rnas_-_Brasil?= Microsoft Dot NET Compact Framework 2 15th Mar 2007 11:36 AM
Accessing the current DataRow of the DataSource from ItemDataBound Nathan Sokalski Microsoft ADO .NET 5 25th Sep 2005 03:10 PM
How to format a DataGrid with a DataRow[] as DataSource? Juan Microsoft ADO .NET 1 28th Mar 2005 03:29 AM
How to format a DataGrid with a DataRow[] as DataSource? Juan Microsoft Dot NET 2 27th Mar 2005 01:18 PM
How to format a DataGrid with a DataRow[] as DataSource? Juan Microsoft C# .NET 1 26th Mar 2005 10:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:53 AM.