Re: checkbox in datalist

Discussion in 'ASP .Net' started by =?Utf-8?B?TWlrZQ==?=, Sep 16, 2004.

  1. 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 & ",")
    next

    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" <> wrote in message
    > news:...
    > >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
    > >

    >
    >
    >
    =?Utf-8?B?TWlrZQ==?=, Sep 16, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nevyn Twyll
    Replies:
    8
    Views:
    1,849
  2. tshad
    Replies:
    0
    Views:
    490
    tshad
    Apr 15, 2005
  3. Vikram

    disable checkbox list checkbox

    Vikram, Jan 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,362
    ThunderMusic
    Jan 25, 2006
  4. =?Utf-8?B?RG90TmV0RGV2?=

    DataGrid and embeded Checkbox..How to find if checkbox clicked

    =?Utf-8?B?RG90TmV0RGV2?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    786
    David Wier
    Oct 6, 2006
  5. Replies:
    1
    Views:
    443
Loading...

Share This Page