Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
how to apply ajaxpartialpagerendering for the dropdownlist control created using html tag select
on change of value in the ddl page is not getting post backed but on change of value in ddl2 page is getting post backed.
How to apply partial pagerendering for ddl2?

XML
<div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
       <asp:TextBox  ID="tb1" runat="server" ></asp:TextBox>      
        <asp:Label ID="Label1" runat="server"></asp:Label>
        <asp:DropDownList ID="ddl" runat="server" AutoPostBack="true">
              <asp:ListItem>1</asp:ListItem>
              <asp:ListItem>2</asp:ListItem>
        </asp:DropDownList>
        <select id="ddl2" name="ddl2" onchange="submit()" runat="server" />
        
       <asp:Button ID="btnChangeText" runat="server"  OnClick="Button1_Click" Text="submit"/>
        </ContentTemplate>
      </asp:UpdatePanel>
    </div>


C#
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class test10 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ddl2.Items.Add(new ListItem ("0", "a"));
            ddl2.Items.Add(new ListItem("1", "b"));
          
          
        }
    }
    protected void Button1_Click(Object obj, EventArgs e)
    {
        Label1.Text = tb1.Text;       
       
    }
}
Posted
Updated 22-Jan-10 0:05am
v3

1 solution

There is always a postback in update panel. Its just that its Async postback.

Since you have kept both the dropdowns inside the update panel , there will be a postback and the page will be rendered partially (region that is placed inside the update panel that triggered the postback)

Please go through the link below for further clarity of UpdatePanel.
Update Panel - MSDN[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900