To display text when user clicks checkbox
-
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 pageprotected 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; } }
-
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 pageprotected 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; } }
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.
-
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.
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