RichDropDown PostBack

Last post 09-20-2006, 5:40 AM by AndyFel. 2 replies.
Sort Posts: Previous Next
  •  09-18-2006, 9:54 AM 22799

    RichDropDown PostBack

    Can a richdropdown do a postback? If so, how is it done?
  •  09-18-2006, 12:46 PM 22805 in reply to 22799

    Re: RichDropDown PostBack

  •  09-20-2006, 5:40 AM 22845 in reply to 22799

    Re: RichDropDown PostBack

    Hi
     
    You could use the onchange attribute of the richdropdown to set a hidden field on the form and then do a submit. You would then have to check the hidden field in the load event and then do whatever you wanted to do.
     
    e.g.
    create rddl
    Dim rddl As New CuteEditor.RichDropDownList(Editor1)
     
    rddl.Attributes("onchange") = "BLOCKED SCRIPTrddlChanged(this.GetValue());" 'ie
    rddl.Attributes("onchange") = "BLOCKED SCRIPTrddlChanged(this[this.selectedIndex].value);" 'firefox
     
    add Javascript function on form
    function
    rddlChanged(rddlValue)

    {

    var hdn = document.getElementById('<%=hdnDoWhat.ClientID%>');

    hdn.value = "rddlChanged";

    var hdnID = document.getElementById('<%=hdnID.ClientID%>');

    hdnID.value = rddlValue;

    document.forms[0].submit();

    }
    Add page load
    Protected
    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Page.IsPostBack Then

    If hdnDoWhat.value = "rddlChanged" Then
    lblMessage.Text = hdnID.value

    End
    If

    hdnDoWhat.Value = "" 'reset because even tho viewstate is disabled it remembers it!

    End If

    End Sub

     

    Hope you get the sense of whats going on, sorry about the formatting never can get these editors to show it how i want it!
View as RSS news feed in XML