Smart    Lucky

Smart Lucky

  • NA
  • 555
  • 639.5k

Facing Issue On Event Change Using Ajax

Nov 4 2015 2:40 PM
Hi every body hope doing well
 i have created a form on which drop some controls and binded these controls at run time on page load event and these controls puted in update panel (Ajax)  on first dropdownlist chage event i have register javascript to show alert but unfortunetly it is not showing ,if i removing the update panel then it is working can any body help me please.
 
 
 
 
<form id="form1" runat="server">
<div>
<asp:ScriptManager runat="server"></asp:ScriptManager>
<asp:UpdatePanel runat="server">
<ContentTemplate>
Accounts<br />
<asp:DropDownList ID="ddlaccountnumber" AutoPostBack="true" OnSelectedIndexChanged="ddlaccountnumber_SelectedIndexChanged" runat="server"></asp:DropDownList><br />
Currency<br />
<asp:DropDownList ID="ddlcurrency" AutoPostBack="true" OnSelectedIndexChanged="ddlcurrency_SelectedIndexChanged" runat="server"></asp:DropDownList><br />
Amount <br />
<asp:TextBox runat="server" ID="txtAmount"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
 
 
 
Code Behind
 
 
public partial class ABC : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindDDlAccount();
BindCurrecy();
}
}
protected void BindDDlAccount()
{
try {
List<ListItem> items = new List<ListItem>()
{
new ListItem{ Text="12346790", Value="423423432"},
new ListItem{ Text="123455", Value="34356565"},
new ListItem{ Text="0908977867", Value="342224443"},
new ListItem{ Text="3425466768767", Value="6756455498797"},
new ListItem{ Text="435345657867", Value="3453456787987"},
new ListItem{ Text="345657787", Value="455467896"},
new ListItem{ Text="34564567678", Value="454678798797"},
};
ddlaccountnumber.DataSource = items;
ddlaccountnumber.DataBind();
}
catch (Exception ex_) { }
}
protected void BindCurrecy()
{
try {
List<ListItem> imtes = new List<ListItem>()
{
new ListItem {Value="PKR", Text="PKR"},
new ListItem {Value="USD", Text="USD"},
new ListItem {Value="INR", Text="INR"},
new ListItem {Value="OMR", Text="OMR"}
};
ddlcurrency.DataSource = imtes;
ddlcurrency.DataBind();
}
catch (Exception ex) { }
}
protected void ddlaccountnumber_SelectedIndexChanged(object sender, EventArgs e)
{
string script = "<script>alert('cliked');</script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "NAMe", script);
}
protected void ddlcurrency_SelectedIndexChanged(object sender, EventArgs e)
{
}
}