stuck on this one

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

  1. I'm trying to find a label and the value within a datalist, i've done this in
    the passed in the datalist_itemdatbound routine and worked likes a charm. Now
    I"m trying to do the samething in a seperate routine and I can't find the
    value.
    in the routine i'm getting the value of the checkbox, checked or not and
    passing that correctly, I also want to the get a the value of the associated
    label with the checkbox and i can't get that working.

    I have this:
    for I = o to datalist.items.count - 1
    checked = datalist.items(I).findcontrol("checkbox")
    text = datatlist.items(I).findcontrol("labelname")
    value = value & checked.checked.tostring() & text.text.tostring()
    next

    i'm getting the checkbox value but not the text value.

    any ideas why this is happening?
     
    =?Utf-8?B?TWlrZQ==?=, Oct 6, 2004
    #1
    1. Advertising

  2. I writing this in the C#. You will be able to convert it to the VB

    CheckBox cb = (CheckBox)datalist.items.Controls.FindControl("checkbox");
    bool cval = cb.Checked;
    Label lbl = (Label)datalist.items.Controls.FindControl("label");

    also you can use code like this:

    CheckBox cb = (CheckBox)datalist.items.Controls[0];
    bool cval = cb.Checked;
    Label lbl = (Label)datalist.items.Controls[1];

    in the C# the first control is 0 and in the VB the first control is 1
    if your listItem has two controls you have to try to find control 1 and 2

    bye

    "Mike" <> wrote in message
    news:...
    > I'm trying to find a label and the value within a datalist, i've done this

    in
    > the passed in the datalist_itemdatbound routine and worked likes a charm.

    Now
    > I"m trying to do the samething in a seperate routine and I can't find the
    > value.
    > in the routine i'm getting the value of the checkbox, checked or not and
    > passing that correctly, I also want to the get a the value of the

    associated
    > label with the checkbox and i can't get that working.
    >
    > I have this:
    > for I = o to datalist.items.count - 1
    > checked = datalist.items(I).findcontrol("checkbox")
    > text = datatlist.items(I).findcontrol("labelname")
    > value = value & checked.checked.tostring() & text.text.tostring()
    > next
    >
    > i'm getting the checkbox value but not the text value.
    >
    > any ideas why this is happening?
    >
     
    Michael Tkachev, Oct 6, 2004
    #2
    1. Advertising

  3. thats simialar to what i have and i can't get the label to be recognized:

    For I = 0 To datalist.Items.Count - 1
    checkbox= dlScores.Items(I).FindControl("chkStuff")
    CarInformation= dlScores.Items(G).FindControl("CarStuff")
    value = value & checkbox.Checked.ToString() & "|" &
    CarInformation.text & "|"
    Next I


    "Michael Tkachev" wrote:

    > I writing this in the C#. You will be able to convert it to the VB
    >
    > CheckBox cb = (CheckBox)datalist.items.Controls.FindControl("checkbox");
    > bool cval = cb.Checked;
    > Label lbl = (Label)datalist.items.Controls.FindControl("label");
    >
    > also you can use code like this:
    >
    > CheckBox cb = (CheckBox)datalist.items.Controls[0];
    > bool cval = cb.Checked;
    > Label lbl = (Label)datalist.items.Controls[1];
    >
    > in the C# the first control is 0 and in the VB the first control is 1
    > if your listItem has two controls you have to try to find control 1 and 2
    >
    > bye
    >
    > "Mike" <> wrote in message
    > news:...
    > > I'm trying to find a label and the value within a datalist, i've done this

    > in
    > > the passed in the datalist_itemdatbound routine and worked likes a charm.

    > Now
    > > I"m trying to do the samething in a seperate routine and I can't find the
    > > value.
    > > in the routine i'm getting the value of the checkbox, checked or not and
    > > passing that correctly, I also want to the get a the value of the

    > associated
    > > label with the checkbox and i can't get that working.
    > >
    > > I have this:
    > > for I = o to datalist.items.count - 1
    > > checked = datalist.items(I).findcontrol("checkbox")
    > > text = datatlist.items(I).findcontrol("labelname")
    > > value = value & checked.checked.tostring() & text.text.tostring()
    > > next
    > >
    > > i'm getting the checkbox value but not the text value.
    > >
    > > any ideas why this is happening?
    > >

    >
    >
    >
     
    =?Utf-8?B?TWlrZQ==?=, Oct 6, 2004
    #3
    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. Nic

    One Hot FSM stuck !!

    Nic, Feb 26, 2004, in forum: VHDL
    Replies:
    5
    Views:
    1,203
    FGreen
    Mar 2, 2004
  2. NuB

    stuck on this one

    NuB, Sep 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    363
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Sep 13, 2005
  3. news.frontiernet.net
    Replies:
    6
    Views:
    1,173
    news.frontiernet.net
    Apr 16, 2004
  4. loveNUNO
    Replies:
    2
    Views:
    971
    loveNUNO
    Nov 20, 2003
  5. Radu
    Replies:
    0
    Views:
    464
Loading...

Share This Page