Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > brain has stalled datagrid checkboxlist

Reply
Thread Tools

brain has stalled datagrid checkboxlist

 
 
cindy
Guest
Posts: n/a
 
      10-18-2005
I am using asp template columns. I display box values from a lookup table.
The datagrid displays field "bookid" and the checkbox displays "category"
field for the book. The category field is a string concatenation of category
values such as CT,MR,NM or just CT
When the grid goes into edit mode I use the itemdatabound to determine
whether to set checkbox as selected based on the value of the category field.
((CheckBoxList)e.Item.Cells[0].FindControl("cbl1")).SelectedValue =
ds.Tables[0].Rows[cnt]["Category"].ToString();
Ok if category = CT How do I get an array into the itemdatabound with comma
delimiter so CT,MR for example will see values as CT and a MR:
The update command for the grid builds the string by looping thru the
selected values from the checkbox. Am I completely missing a better way?
--
cindy
 
Reply With Quote
 
 
 
 
Phillip Williams
Guest
Posts: n/a
 
      10-18-2005
string strCategory = "CT,MR";
CheckBoxList cbl1= (CheckBoxList)e.Item.Cells[0].FindControl("cbl1");
string[] aCategories= strCategory.Split (',');
foreach (string str in aCategories)
{
System.Web.UI.WebControls.ListItem li= cbl1.Items.FindByValue (str);
if (li != null) li.Selected =true ;
}
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"cindy" wrote:

> I am using asp template columns. I display box values from a lookup table.
> The datagrid displays field "bookid" and the checkbox displays "category"
> field for the book. The category field is a string concatenation of category
> values such as CT,MR,NM or just CT
> When the grid goes into edit mode I use the itemdatabound to determine
> whether to set checkbox as selected based on the value of the category field.
> ((CheckBoxList)e.Item.Cells[0].FindControl("cbl1")).SelectedValue =
> ds.Tables[0].Rows[cnt]["Category"].ToString();
> Ok if category = CT How do I get an array into the itemdatabound with comma
> delimiter so CT,MR for example will see values as CT and a MR:
> The update command for the grid builds the string by looping thru the
> selected values from the checkbox. Am I completely missing a better way?
> --
> cindy

 
Reply With Quote
 
 
 
 
cindy
Guest
Posts: n/a
 
      10-18-2005
Thank you very much, I had just stalled and you replied so quickly.
--
cindy


"Phillip Williams" wrote:

> string strCategory = "CT,MR";
> CheckBoxList cbl1= (CheckBoxList)e.Item.Cells[0].FindControl("cbl1");
> string[] aCategories= strCategory.Split (',');
> foreach (string str in aCategories)
> {
> System.Web.UI.WebControls.ListItem li= cbl1.Items.FindByValue (str);
> if (li != null) li.Selected =true ;
> }
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "cindy" wrote:
>
> > I am using asp template columns. I display box values from a lookup table.
> > The datagrid displays field "bookid" and the checkbox displays "category"
> > field for the book. The category field is a string concatenation of category
> > values such as CT,MR,NM or just CT
> > When the grid goes into edit mode I use the itemdatabound to determine
> > whether to set checkbox as selected based on the value of the category field.
> > ((CheckBoxList)e.Item.Cells[0].FindControl("cbl1")).SelectedValue =
> > ds.Tables[0].Rows[cnt]["Category"].ToString();
> > Ok if category = CT How do I get an array into the itemdatabound with comma
> > delimiter so CT,MR for example will see values as CT and a MR:
> > The update command for the grid builds the string by looping thru the
> > selected values from the checkbox. Am I completely missing a better way?
> > --
> > cindy

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
left brain and right brain permutations pataphor Python 0 06-14-2009 07:14 PM
Stalled ticket in Python bug tracker Steven D'Aprano Python 6 01-24-2009 08:39 AM
After running for four days, Python program stalled John Nagle Python 2 12-12-2007 09:26 PM
Anchored Regexp get stalled or hung rnicz Ruby 6 11-19-2004 09:08 PM
PC boot-up stalled Ken Doughty Computer Support 7 02-11-2004 07:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57