ASP.NET 2.0 Radio button without postbacks, hiding panel information

Discussion in '.NET' started by dotnetjunkie, Oct 11, 2006.

  1. dotnetjunkie

    dotnetjunkie

    Joined:
    Oct 11, 2006
    Messages:
    2
    Likes Received:
    0
    Hi,
    I have a payment and shipping information entry page in my application that
    has two sets of address fields. I have a radio button the users can set if
    the addresses are the same. That radio button does an auto postback which
    triggers an event to disable the second set of fields and fill in values.
    The client likes the way the page works, but not the performance.

    Now, i do not want to use AutoPostBack as the page refreshes everytime and is annoying. How can i implement this with javascript and using REgisterClientScriptBlock. WHere do i call REgisterClientSCriptBlock and what do i need to pass in it? How do i access the text boxes from the javascript.

    Sample code is appreciated.

    Thanks,
     
    dotnetjunkie, Oct 11, 2006
    #1
    1. Advertisements

  2. dotnetjunkie

    dotnetjunkie

    Joined:
    Oct 11, 2006
    Messages:
    2
    Likes Received:
    0
    i figured it out.

    Have fun
     
    dotnetjunkie, Oct 12, 2006
    #2
    1. Advertisements

  3. dotnetjunkie

    priyadharsini

    Joined:
    May 6, 2008
    Messages:
    1
    Likes Received:
    0
    hi
    Im also facing the same problem can u post the solution here

    i tried many ways but coulnt fix ..here is my code
    _______________________________________________________
    if (!IsClientScriptBlockRegistered("ScopeValue"))
    {

    string scriptString = "<script type='text/javascript' language='JavaScript'>";
    scriptString += "function getRadioValue(){";
    scriptString += "var test = document.getElementById('<%=rbtnScope.ClientID%>');";
    scriptString += "for(int i=0;i<test.length;i++)";
    scriptString += "{";
    scriptString += "if (test.Checked)";
    scriptString += "{";
    scriptString += "var text = test.Text;";
    scriptString += "var value = test.value;";
    //scriptString += "var text = test.options[document.getElementById('<%=rbtnScope.ClientID%>').Checked].Text";
    //scriptString += "var value = test.options[document.getElementById('<%=rbtnScope.ClientID%>').Checked].Value";
    scriptString += "}";
    scriptString += "}";
    scriptString += "</script>";
    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ScopeValue", scriptString);
    }
    rbtnScope.Attributes.Add("onClick", "javascript:alert(value)");
    ________________________________________________
    any suggestions is appreciated
    Thanks in advance
     
    priyadharsini, May 6, 2008
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bill
    Replies:
    3
    Views:
    1,133
    Damien
    Oct 10, 2005
  2. Scott D Johnson
    Replies:
    1
    Views:
    1,382
    Scott D Johnson
    Sep 27, 2006
  3. gregfocker@earthlink.net

    AJAX - Partial Postbacks are now Full Postbacks ?!!

    gregfocker@earthlink.net, Jan 25, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    608
    gregfocker@earthlink.net
    Jan 25, 2007
  4. Ryan Liu
    Replies:
    1
    Views:
    750
    Alexey Smirnov
    Mar 17, 2009
  5. tristan_sehgal@yahoo.co.uk

    Radio Button Column In GridView Causing Postbacks In Ajax

    tristan_sehgal@yahoo.co.uk, Mar 23, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    1,668
    tristan_sehgal@yahoo.co.uk
    Mar 23, 2009
  6. Matt
    Replies:
    2
    Views:
    514
  7. prasad srirambhatla
    Replies:
    2
    Views:
    454
    Teemu Keiski
    Aug 28, 2003
  8. Hiten
    Replies:
    1
    Views:
    949
    Vidar Petursson
    May 26, 2004
Loading...