RadComboBox - Allow only certain items to postback

Thread is closed for posting
1 posts, 1 answers
  1. Answer
    Telerik Admin
    Telerik Admin avatar
    1679 posts
    Member since:
    Oct 2004

    Posted 14 Mar 2008 Link to this post


    Requirements

    RadControls version

    RadComboBox 2.84
    RadComboBox AJAX (Prometheus)
    Telerik.Web.UI 2007.3.1425

    .NET version

    2.0

    Visual Studio version

    2005

    programming language

    C#

    browser support

    all browsers supported by RadControls


     
  2. PROJECT DESCRIPTION
    This project shows how you can make only a certain combo items to cause a postback (and fire the server-side event SelectedIndexChanged).



  3. <telerik:RadComboBox ID="RadComboBox1"  
    AutoPostBack="false" 
    OnClientSelectedIndexChanged="onClientSelectedIndexChanged" 
    runat="server" > 
        <Items> 
            <telerik:RadComboBoxItem runat="server" Text="No Postback Item 1" /> 
            <telerik:RadComboBoxItem runat="server" Text="Do postback Item 1" /> 
            <telerik:RadComboBoxItem runat="server" Text="No postback Item 2" /> 
            <telerik:RadComboBoxItem runat="server" Text="Do postback Item 2" /> 
        </Items> 
    </telerik:RadComboBox> 

    function onClientSelectedIndexChanged(sender, eventArgs) 
        var text = eventArgs.get_item().get_text(); 
        if (text == "Do postback Item 1" || text == "Do postback Item 2" ) 
        { 
            __doPostBack("RadComboBox1"'{\"Command\" : \"Select\"}'); 
        }       





    <rad:RadComboBox ID="RadComboBox1"  
    AutoPostBack="false"    
    OnClientSelectedIndexChanged="onClientSelectedIndexChanged" 
    runat="server"  
    Width="150px" > 
        <Items> 
            <rad:RadComboBoxItem runat="server" Text="Do Postback 1" /> 
            <rad:RadComboBoxItem runat="server" Text="Do not Postback 1" /> 
            <rad:RadComboBoxItem runat="server" Text="Do Postback 2" /> 
            <rad:RadComboBoxItem runat="server" Text="Do not Postback 2" /> 
        </Items> 
    </rad:RadComboBox> 

    function onClientSelectedIndexChanged(item) 
        var text = item.Text; 
        if (text == "Do Postback 2" || text == "Do Postback 1" ) 
        { 
            __doPostBack("RadComboBox1""TextChange"); 
        }    

  • Back to Top