Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: checkbox in datalist

Thread Tools

Re: checkbox in datalist

Posts: n/a
I got the single selection to work but on the multiple selections it blows up
when it compiles on this line:

for each sCars in datalist1.items
dataitem = (CType(e.item.FindControl("checkbox1").value & ",")

it doesn't like e.item syntax

"GrantMagic" wrote:

> Hi Mike
> that depends if that can check multiple items or not.
> Single Item
> If they can only check one, set the autopostback attribute to true.
> Create an OnItemCommand in the DataList, and in that command, get the
> requested information from the EventArgument, and redirect the user with the
> requested items ID number.
> E.g.
> Sub DgItemCommand(Sender as Object, e as DataListEventArgs)
> Response.Redirect("link?ID=" & (CType(e.Item.FindControl("tbID"),
> TextBox).Text)
> '(Where tbID holds the rows ID number)
> End Sub
> Multiple Item
> Here you'll have to make a general button, which loops through the datalist
> and picks up all the checked items.
> Then create a comma seperate list and redirect that wasy
> E.g.
> Sub ButtonClick(Sender as Object, e as EventArgs)
> Dim str as string = "";
> Dim item As DataListItem
> For Each item In DataList1.Items
> str += (CType(e.Item.FindControl("tbID"), TextBox).Text &
> ","
> Next item
> Response.Redirect("Response.Redirect("link?ID=" & str)
> End Sub
> On the subsequent page you can then breadk up that string
> "Mike" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I have a check box in a datalist and the user can check it or leave it
> >blank.
> > if they check it they will be able to click a button and go to a new page
> > with information on the item they check. How can i get if the checkbox has
> > been checked(in the datalist) or not and pass that value to the next page?
> > VB.NET
> >


Reply With Quote

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
CheckBox Outside DataList & Labels Inside DataList ASP .Net 1 12-24-2006 02:28 PM
DataGrid and embeded Checkbox..How to find if checkbox clicked =?Utf-8?B?RG90TmV0RGV2?= ASP .Net 1 10-06-2006 04:11 PM
disable checkbox list checkbox Vikram ASP .Net 1 01-25-2006 02:59 PM
Text on Checkbox below the checkbox tshad ASP .Net 0 04-14-2005 11:26 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM