Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. To display text when user clicks checkbox

To display text when user clicks checkbox

Scheduled Pinned Locked Moved Web Development
javascriptsysadmin
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BINOVAR
    wrote on last edited by
    #1

    Iam using Ajax is there any diff. approach to finish it using Javascript aspx page <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> <!-- <asp:Panel ID="Panel2" runat="server"> --> <table id="Table2" cellspacing="0" cellpadding="0" runat="server" class="Table2Style" > <tr id="rowDD" runat="server"> <td width="115px"> <asp:Label ID="DDLabel" runat="server" CssClass="LabelText" ></asp:Label> </td> <td id="colDDImage" width="17px" background="Images/DDImage.bmp" runat="server"> </td> </tr> </table> <!-- <tr> --> <!-- <td colspan="2"> --> <div id="Div1" runat="server"> <!-- <asp:Panel ID="Panel1" runat="server" > --> <table id="Table1" cellspacing="0" cellpadding="0" runat="server" class="Table1Style"> <tr runat="server" id="rowChk"> <td width="132px"> <asp:CheckBoxList ID="Chk_countries" runat="server" CssClass="CheckBoxList" AutoPostBack="True" OnSelectedIndexChanged="Chk_countries_SelectedIndexChanged"> </asp:CheckBoxList> </td> </tr> </table> <!-- </asp:Panel> --> </div> <!-- </td> --> <!-- </tr> --> <!-- </table> --> <!-- </asp:Panel> --> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Chk_countries" /> </Triggers> </asp:UpdatePanel> aspx.cs page protected void Chk_countries_SelectedIndexChanged(object sender, EventArgs e) { string str_CheckedValue = ""; for (int i = 0; i < Chk_countries.Items.Count; i++) { if (Chk_countries.Items[i].Selected == true) { str_CheckedValue = str_CheckedValue + Chk_countries.Items[i].Value + ","; } } if (str_CheckedValue.Length > 0) { str_CheckedValue = str_CheckedValue.Substring(0, str_CheckedValue.Length - 1); DDLabel.Text = str_CheckedValue; } else { DDLabel.Text = SelectDefaultText; DDLabel.ToolTip = SelectDefaultText; } }

    B 1 Reply Last reply
    0
    • B BINOVAR

      Iam using Ajax is there any diff. approach to finish it using Javascript aspx page <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> <!-- <asp:Panel ID="Panel2" runat="server"> --> <table id="Table2" cellspacing="0" cellpadding="0" runat="server" class="Table2Style" > <tr id="rowDD" runat="server"> <td width="115px"> <asp:Label ID="DDLabel" runat="server" CssClass="LabelText" ></asp:Label> </td> <td id="colDDImage" width="17px" background="Images/DDImage.bmp" runat="server"> </td> </tr> </table> <!-- <tr> --> <!-- <td colspan="2"> --> <div id="Div1" runat="server"> <!-- <asp:Panel ID="Panel1" runat="server" > --> <table id="Table1" cellspacing="0" cellpadding="0" runat="server" class="Table1Style"> <tr runat="server" id="rowChk"> <td width="132px"> <asp:CheckBoxList ID="Chk_countries" runat="server" CssClass="CheckBoxList" AutoPostBack="True" OnSelectedIndexChanged="Chk_countries_SelectedIndexChanged"> </asp:CheckBoxList> </td> </tr> </table> <!-- </asp:Panel> --> </div> <!-- </td> --> <!-- </tr> --> <!-- </table> --> <!-- </asp:Panel> --> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Chk_countries" /> </Triggers> </asp:UpdatePanel> aspx.cs page protected void Chk_countries_SelectedIndexChanged(object sender, EventArgs e) { string str_CheckedValue = ""; for (int i = 0; i < Chk_countries.Items.Count; i++) { if (Chk_countries.Items[i].Selected == true) { str_CheckedValue = str_CheckedValue + Chk_countries.Items[i].Value + ","; } } if (str_CheckedValue.Length > 0) { str_CheckedValue = str_CheckedValue.Substring(0, str_CheckedValue.Length - 1); DDLabel.Text = str_CheckedValue; } else { DDLabel.Text = SelectDefaultText; DDLabel.ToolTip = SelectDefaultText; } }

      B Offline
      B Offline
      Bradml
      wrote on last edited by
      #2

      AJAX is a technique of coding. It stands for Asynchronous Javascript And Xml. It is using the Javascript language. In short I have two answers; 1. You're question is incorrect (which is a skill mind you). 2. You might be better off asking this in the ASP.net forum.


      Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.

      T 1 Reply Last reply
      0
      • B Bradml

        AJAX is a technique of coding. It stands for Asynchronous Javascript And Xml. It is using the Javascript language. In short I have two answers; 1. You're question is incorrect (which is a skill mind you). 2. You might be better off asking this in the ASP.net forum.


        Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.

        T Offline
        T Offline
        Thunderbox666
        wrote on last edited by
        #3

        Bradml wrote:

        1. You're question is incorrect (which is a skill mind you).

        :laugh:


        "There are three sides to every story. Yours, mine and the truth" ~ unknown "All things good to know are difficult to learn" ~ Greek Proverb "The only place success comes before work is in the dictionary" ~ Vidal Sassoon

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups