Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

help convert vb.net event into javascript for better user experience

Posted on 2007-12-05
5
Medium Priority
?
568 Views
Last Modified: 2012-05-05
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(ByVal 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="RBL_SelectedIndexChanged"
                                                                                                RepeatDirection="Horizontal" 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:ListItem>
                                                                                                    </asp:RadioButtonList>
                                                           
0
Comment
Question by:gianitoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:divinewind80
ID: 20411361
I assume you are not using AJAX, correct?  I would recommend that you do this.  Check out the link below for details:  

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...
0
 
LVL 1

Author Comment

by:gianitoo
ID: 20411384
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.  

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_23000618.html
0
 
LVL 9

Expert Comment

by:divinewind80
ID: 20411534
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.
0
 
LVL 1

Author Comment

by:gianitoo
ID: 20411553
yes i haveno idea how to do it from javascript.  can u provide full code?
0
 
LVL 9

Accepted Solution

by:
divinewind80 earned 2000 total points
ID: 20412089
I would suggest something like the following:

-- In HTML --
<script language="javascript">
setInterval("checkchanged()",2500); //this will check every 2.5 seconds

function checkchanged()
{
if(document.getElementById('RBL).selectedIndex==1||document.getElementById('RBL').selectedIndex==2)
{
document.all.div1.style.visibility='block'
}
}
</scipt>

You will have to mess around with this a bit... but the idea is there, at least.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

647 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question