Onclick in a ListItem

Last post 07-07-2009 11:36 AM by StrangerMike. 8 replies.

Sort Posts:

  • Onclick in a ListItem

    06-30-2009, 3:18 PM
    • Participant
      1,934 point Participant
    • StrangerMike
    • Member since 08-21-2003, 12:16 PM
    • B.C. Pa
    • Posts 1,069

    Is it possible to load a session variable in an onclick event of a listItem?

    Is there such an animal? 

    If so how would i do this?

    me.session("Info") = " ...."

    <asp:ListItem Text="My Accounts!" Value="~/Accounts/AccountsOrcAll.aspx" onmouseover="javascript:this.style.color='Red';" onmouseout="javascript:this.style.color='Blue';" ></asp:ListItem>

    thanks!

    Thanks
  • Re: Onclick in a ListItem

    06-30-2009, 7:33 PM

    Is this like a CheckBoxList?  If so, you can handle the SelectedIndexChanged event.

  • Re: Onclick in a ListItem

    06-30-2009, 9:47 PM
    • Contributor
      5,624 point Contributor
    • RatheeshC
    • Member since 04-25-2008, 6:05 PM
    • Posts 1,198

     Hi,

    Is there any parent control (container) for the listitem..?

    Thanks

    Thanks
    Ratheesh

    Please mark it as answer if it resolves your issue.
  • Re: Onclick in a ListItem

    07-03-2009, 11:54 AM
    • Participant
      1,934 point Participant
    • StrangerMike
    • Member since 08-21-2003, 12:16 PM
    • B.C. Pa
    • Posts 1,069

     Thanks for your reply:

    No this is not a checkboxlist.  It's actually a bulleted list, see below:

    <asp:BulletedList  ID="BulledList1" runat=server DisplayMode="HyperLink">
      <asp:ListItem Text="Accounts" Value="~/Accounts/AccountsOrcAll.aspx" onmouseover="javascript:this.style.color='Red';" onmouseout="javascript:this.style.color='Blue';"></asp:ListItem>
      <asp:ListItem  Text="My Accounts!" Value="~/Accounts/AccountsOrcAll.aspx"  onmouseover="javascript:this.style.color='Red';" onmouseout="javascript:this.style.color='Blue';" ></asp:ListItem>
      </asp:BulletedList>


     

     

    Thanks
  • Re: Onclick in a ListItem

    07-03-2009, 11:55 AM
    • Participant
      1,934 point Participant
    • StrangerMike
    • Member since 08-21-2003, 12:16 PM
    • B.C. Pa
    • Posts 1,069

    Yes. It's a bulletedlist.

    Thanks
  • Re: Onclick in a ListItem

    07-03-2009, 1:05 PM
    • Contributor
      5,624 point Contributor
    • RatheeshC
    • Member since 04-25-2008, 6:05 PM
    • Posts 1,198

    hi,

    you can use the radiobuttonselected index changed event...

    Thanks
    Ratheesh

    Please mark it as answer if it resolves your issue.
  • Re: Onclick in a ListItem

    07-03-2009, 3:16 PM
    Answer
    • All-Star
      23,280 point All-Star
    • budugu
    • Member since 01-12-2006, 2:15 PM
    • North Carolina
    • Posts 3,502

     You can use "onclick " event for BulletedList control. I changed DispalyMode to "LinkButton". Check this..

    <asp:BulletedList  ID="BulledList1" runat="server" DisplayMode="LinkButton" 
            onclick="BulledList1_Click"  >  
    <asp:ListItem Text="Accounts" Value="~/Accounts/AccountsOrcAll.aspx" onmouseover="javascript:this.style.color='Red';" onmouseout="javascript:this.style.color='Blue';">
    </asp:ListItem>  
      <asp:ListItem  Text="My Accounts!" Value="~/Accounts/AccountsOrcAll.aspx"  onmouseover="javascript:this.style.color='Red';" onmouseout="javascript:this.style.color='Blue';" >
    </asp:ListItem>  
     </asp:BulletedList>  


     


     

    Protected Sub BulledList1_Click(ByVal sender As Object, ByVal e As BulletedListEventArgs) 
        Session("BulletValue") = "New value" 
    End Sub 



     

    Vijay Kodali || My Blog


    "Don't be afraid to be wrong; otherwise you'll never be right."
  • Re: Onclick in a ListItem

    07-07-2009, 11:26 AM
    • Participant
      1,934 point Participant
    • StrangerMike
    • Member since 08-21-2003, 12:16 PM
    • B.C. Pa
    • Posts 1,069

    Thanks Budugu,

    I probably did not mention this:

    I only want to fill the value of the session variable when  the second listitem is clicked.

    Is there a way to do this?

     

     

     

    Thanks
  • Re: Onclick in a ListItem

    07-07-2009, 11:36 AM
    Answer
    • Participant
      1,934 point Participant
    • StrangerMike
    • Member since 08-21-2003, 12:16 PM
    • B.C. Pa
    • Posts 1,069

    I found a way around this:

    I set the transfer value to : Vale="~Accounts/AccountsOrCall.aspx?User=Yes"

    This will tell the receiving form wether or not to use the session variable that was set in the prior form.

    This will work fine.

    Thanks for all of your time.

    Thanks
Page 1 of 1 (9 items)