Hi simflex,
You need to reopen the modalpopup on PostBack i.e. DropDownList change.
Please refer below sample.
HTML
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Button ID="btnSearch" runat="server" Text="Submit" />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajax:ModalPopupExtender ID="installAddress_MPE" runat="server" TargetControlID="btnSearch"
PopupControlID="installnew" CancelControlID="btnClose" BackgroundCssClass="modalBackground" />
<asp:Panel ID="installnew" runat="server" CssClass="modalPopup" align="center" Style="display: none">
<asp:Table ID="Table1" runat="server">
<asp:TableRow>
<asp:TableCell ID="TableCell3" runat="server">
<asp:Label ID="installAddressHeader" runat="server" Text="New Installation Address Entry" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<div id="divRebatable" class="popupdiv">
<asp:TextBox ID="txt_toiletsizes" placeholder="Enter new Toiltet GPF" runat="server"></asp:TextBox>
<asp:TextBox ID="txt_newAmount" placeholder="Enter amount" Width="100px" runat="server"></asp:TextBox>
<asp:Button ID="btn_add" runat="server" Text="Add It" />
<asp:Table ID="rebateTable" runat="server">
<asp:TableRow CssClass="divHeader">
<asp:TableHeaderCell ColumnSpan="4">Add Toilets</asp:TableHeaderCell></asp:TableRow>
<asp:TableRow ID="allToilets" runat="server">
<asp:TableHeaderCell>How many toilets?</asp:TableHeaderCell>
<asp:TableCell>
<asp:DropDownList ID="ddlNumber" runat="server" OnSelectedIndexChanged="ddlNumber_SelectedIndexChanged"
AutoPostBack="true">
<asp:ListItem Text="--Select--" Value=""></asp:ListItem>
<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="2"></asp:ListItem>
<asp:ListItem Text="3" Value="3"></asp:ListItem>
</asp:DropDownList>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
<br />
<div>
<asp:Repeater ID="DynamicRepeater" runat="server">
<HeaderTemplate>
<table border="1">
<tr>
<td>
Toilet Size
</td>
<td>
Model#
</td>
<td>
Date Upgraded
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:DropDownList ID="ddlToiletGPF" AutoPostBack="true" runat="server" OnSelectedIndexChanged="OnSelectedIndexChanged">
<asp:ListItem>--Select Any--</asp:ListItem>
<asp:ListItem Value="ASPSnippets" Text="ASPSnippets" />
<asp:ListItem Value="ASPforums" Text="ASPforums" />
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="ModelNumber" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="DateUpgraded" runat="server"></asp:TextBox>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<br />
<asp:Label ID="lblSuccess" runat="server" Text=""></asp:Label>
</div>
<asp:Button ID="btnClose" runat="server" Text="Close" />
</asp:Panel>
<asp:Label ID="lblMsg" runat="server" Text="" /><br />
Namespace
C#
using System.Data;
VB.Net
Imports System.Data
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindRepeater();
}
}
protected void ddlNumber_SelectedIndexChanged(object sender, EventArgs e)
{
installAddress_MPE.Show();
}
protected void OnSelectedIndexChanged(object sender, EventArgs e)
{
installAddress_MPE.Show();
}
private void BindRepeater()
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3]{
new DataColumn("Toilet Size"),
new DataColumn("Model #"),
new DataColumn("Date Upgraded")
});
DropDownList ddl = DynamicRepeater.FindControl("ddlToiletGPF") as DropDownList;
TextBox txt = DynamicRepeater.FindControl("ModelNumber") as TextBox;
TextBox txt2 = DynamicRepeater.FindControl("DateUpgraded") as TextBox;
dt.Rows.Add(ddl, txt, txt2);
DynamicRepeater.DataSource = dt;
DynamicRepeater.DataBind();
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Me.BindRepeater()
End If
End Sub
Protected Sub ddlNumber_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
installAddress_MPE.Show()
End Sub
Protected Sub OnSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
installAddress_MPE.Show()
End Sub
Private Sub BindRepeater()
Dim dt As DataTable = New DataTable()
dt.Columns.AddRange(New DataColumn(2) {New DataColumn("Toilet Size"), New DataColumn("Model #"), New DataColumn("Date Upgraded")})
Dim ddl As DropDownList = TryCast(DynamicRepeater.FindControl("ddlToiletGPF"), DropDownList)
Dim txt As TextBox = TryCast(DynamicRepeater.FindControl("ModelNumber"), TextBox)
Dim txt2 As TextBox = TryCast(DynamicRepeater.FindControl("DateUpgraded"), TextBox)
dt.Rows.Add(ddl, txt, txt2)
DynamicRepeater.DataSource = dt
DynamicRepeater.DataBind()
End Sub
Screenshot