gianitoo
asked on
help convert vb.net event into javascript for better user experience
i am using this function below and the user experience sucks because it does a postback. how can i just create javascript so we dont have to do a postback eachtime the user selects a choice in any radiobutton.
Protected Sub RBL_SelectedIndexChanged(B yVal sender As Object, ByVal e As System.EventArgs)
Dim RBL As RadioButtonList
RBL = CType(sender, RadioButtonList)
If RBL.SelectedItem.Text = "1" Or RBL.SelectedItem.Text = "2" Then
Me.Panel3.Visible = True
End If
End Sub
<asp:RadioButtonList
ID="jmirating" runat="server" AutoPostBack="True"
CssClass="whiteradio" onselectedindexchanged="RB L_Selected IndexChang ed"
RepeatDirection="Horizonta l" TextAlign="Left" Width="403px">
<asp:ListItem Value="5">-</asp:ListItem>
<asp:ListItem Value="4">-</asp:ListItem>
<asp:ListItem Value="3">-</asp:ListItem>
<asp:ListItem Value="2">-</asp:ListItem>
<asp:ListItem Value="1">-</asp:ListItem>
<asp:ListItem Value="N/A">-</asp:ListIte m>
</asp:RadioButtonList>
Protected Sub RBL_SelectedIndexChanged(B
Dim RBL As RadioButtonList
RBL = CType(sender, RadioButtonList)
If RBL.SelectedItem.Text = "1" Or RBL.SelectedItem.Text = "2" Then
Me.Panel3.Visible = True
End If
End Sub
<asp:RadioButtonList
ID="jmirating" runat="server" AutoPostBack="True"
CssClass="whiteradio" onselectedindexchanged="RB
RepeatDirection="Horizonta
<asp:ListItem Value="5">-</asp:ListItem>
<asp:ListItem Value="4">-</asp:ListItem>
<asp:ListItem Value="3">-</asp:ListItem>
<asp:ListItem Value="2">-</asp:ListItem>
<asp:ListItem Value="1">-</asp:ListItem>
<asp:ListItem Value="N/A">-</asp:ListIte
</asp:RadioButtonList>
ASKER
i have tried the update panel but there is an issue with my multiview control.
when i go next it does not go to the top of the page in the next view. it is an issue with updatepanel that i can figure out. i have asked but nobody helps me.
https://www.experts-exchange.com/questions/23000618/pleae-this-is-urgent-help-multiview-page-inside-updatepanel.html
when i go next it does not go to the top of the page in the next view. it is an issue with updatepanel that i can figure out. i have asked but nobody helps me.
https://www.experts-exchange.com/questions/23000618/pleae-this-is-urgent-help-multiview-page-inside-updatepanel.html
I see.
Try sticking the panel in a div, like so:
<div style="visiblity:hidden;" id="div1" runat="server">
<asp:panel runat=server id="panel1" visible="true" />
</div>
The ID and RUNAT are probably necessary... but it may take a little tinkering. Give it a try and see what happens. You should be able to reference this div from Javascript. If you need some ideas on how to trigger the Javascript from a serverside control, let me know.
Try sticking the panel in a div, like so:
<div style="visiblity:hidden;" id="div1" runat="server">
<asp:panel runat=server id="panel1" visible="true" />
</div>
The ID and RUNAT are probably necessary... but it may take a little tinkering. Give it a try and see what happens. You should be able to reference this div from Javascript. If you need some ideas on how to trigger the Javascript from a serverside control, let me know.
ASKER
yes i haveno idea how to do it from javascript. can u provide full code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.asp.net/ajax/
One reason why I say this is because you will most likely find it much easier to use an UpdatePanel in AJAX than to try to unhide a hidden panel in Javascript. Often, I have found, Javascript has issues finding ASP.NET controls that are hidden...