nabeel nader
asked on
bootstrap controls with ajax update panel in Modal
Hi, Share with us some code and where you're using the "postback", apparently you need to re-init the controls...
ASKER
here HTML Code
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table class="table mb-0">
<tbody>
<tr>
<td>
<div class="form-group">
<%-- <input type="text" placeholder="Type something" >--%>
<asp:TextBox ID="txt_RequestName" runat="server" class="form-control parsley" placeholder="ادخل مسمي الطلب / الخدمة"></asp:TextBox>
</div>
</td>
<td>
<label>مسمى الطلب / الخدمة</label></td>
</tr>
<tr>
<td>
<div class="form-group">
<asp:DropDownList ID="DDL_Municipality" runat="server" CssClass="form-control select2" AutoPostBack="true" OnSelectedIndexChanged="DDL_Municipality_SelectedIndexChanged">
</asp:DropDownList>
</div>
</td>
<td>
<label class="control-label">البــلديــة</label>
</td>
</tr>
<tr>
<td>
<%-- <div class="form-group">--%>
<asp:DropDownList ID="DDL_DepAdmin" runat="server" CssClass="form-control select2" AutoPostBack="true" OnSelectedIndexChanged="DDL_DepAdmin_SelectedIndexChanged">
</asp:DropDownList>
<%--</div>--%>
</td>
<td>
<label class="control-label">الـوكــالــة</label>
</td>
</tr>
<tr>
<td>
<div class="form-group">
<asp:DropDownList ID="DDL_Management" runat="server" CssClass="form-control select2">
</asp:DropDownList>
</div>
</td>
<td>
<label class="control-label">الإدارة</label>
</td>
</tr>
<tr>
<td>
<div class="form-group">
<asp:DropDownList ID="DDL_SubDepartment" runat="server" CssClass="form-control select2">
</asp:DropDownList>
</div>
</td>
<td>
<label class="control-label">القسم الفرعي</label>
</td>
</tr>
<tr>
<td>
<div class="form-group">
<asp:DropDownList ID="DDL_Priority" runat="server" CssClass="form-control select2">
</asp:DropDownList>
</div>
</td>
<td>
<label class="control-label">مدي أهمية الخدمة / الطلب</label>
</td>
</tr>
<%-- <tr>
<td>
<div class="form-group">
<asp:DropDownList ID="DropDownList3" runat="server" CssClass="form-control select2">
</asp:DropDownList>
</div>
</td>
<td>
<label class="control-label">مدي أهمية الخدمة / الطلب</label>
</td>
</tr>--%>
<tr>
<td>
<div class="input-group bootstrap-touchspin bootstrap-touchspin-injected">
<input id="txt_HoursDuration" runat="server" type="text" value="" name="demo3_21" class="form-control">
</div>
</td>
<td>
<label class="control-label">عدد ساعات الإستجابة</label>
</td>
</tr>
<tr>
<td>
<div class="form-group">
<input type="checkbox" id="check_Valid" switch="danger" checked runat="server"/>
<label for="switch8" data-on-label="Yes"
data-off-label="No">
</label>
</div>
</td>
<td>
<label class="control-label">مفعل / غير مفعل</label>
</td>
</tr>
</tbody>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Hear Code Behind
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
DataView DV_RequestNames = RequestName.SelectAllRequestNames();
Session["AllRequestNames"] = DV_RequestNames;
Repeater_RequestNames.DataSource = DV_RequestNames;
Repeater_RequestNames.DataBind();
GetMunicipality(); GetAllDepartmentAdmin(); GetAllDepartments(); GetRequesPriority();
}
}
catch
{
}
}
private void GetMunicipality()
{
MunicipalityManagement municipality = new MunicipalityManagement(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
DataView DV_Municipality = municipality.SelectAllActiveMunicipality();
DDL_Municipality.DataSource = DV_Municipality;
DDL_Municipality.DataTextField = "MunicipalityName"; DDL_Municipality.DataValueField = "MunicipalityID";
DDL_Municipality.DataBind();
DDL_Municipality.Items.Insert(0, "من فضلك اختر البلدية");
}
private void GetRequesPriority()
{
GeneralData DataInfo = new GeneralData(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
DataView DV_Piriority = DataInfo.SelectAllRequesPriority();
DDL_Priority.DataSource = DV_Piriority;
DDL_Priority.DataTextField = "PriorityName"; DDL_Priority.DataValueField = "RequestPriorityID";
DDL_Priority.DataBind();
DDL_Priority.Items.Insert(0, "من فضلك اختر أهمية الطلب");
}
private void GetAllDepartmentAdmin()
{
MunicipalityManagement municipality = new MunicipalityManagement(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
DataView DV_DepartmentAdmin = municipality.SelectAllActiveDepartmentAdmin();
Session["AllActiveDepartmentAdmin"] = DV_DepartmentAdmin;
}
private void GetAllDepartments()
{
MunicipalityManagement municipality = new MunicipalityManagement(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
DataView DV_Departments = municipality.SelectAllActiveDepartment();
Session["AllActiveDepartments"] = DV_Departments;
}
protected void Repeater_RequestNames_ItemCommand(object source, RepeaterCommandEventArgs e)
{
try
{
if(e.CommandName=="Update")
{
DataView DV_RequestNames=(DataView) Session["AllRequestNames"] ;
if(DV_RequestNames.Count>0)
{
DDL_Priority.SelectedItem.Value = DV_RequestNames[e.Item.ItemIndex]["RequestPiriortyID"].ToString();
DDL_Municipality.SelectedItem.Value = DV_RequestNames[e.Item.ItemIndex]["MunicipalityID"].ToString();
txt_RequestName.Text = DV_RequestNames[e.Item.ItemIndex]["RequestName"].ToString();
}
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal();", true);
}
}
catch
{
}
}
protected void DDL_Municipality_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
DataView DV_DepartmentAdmin = (DataView)Session["AllActiveDepartmentAdmin"];
DV_DepartmentAdmin.RowFilter = "MunicipalityID="+DDL_Municipality.SelectedValue.ToString();
DDL_DepAdmin.DataSource = DV_DepartmentAdmin;
DDL_DepAdmin.DataTextField = "DepartmentAdmin"; DDL_DepAdmin.DataValueField = "DepartmentAdminID";
DDL_DepAdmin.DataBind();
}
catch
{
}
}
protected void DDL_DepAdmin_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
DataView DV_Department = (DataView)Session["AllActiveDepartments"];
DV_Department.RowFilter = "DepartmentAdminID=" + DDL_DepAdmin.SelectedValue.ToString();
DDL_Management.DataSource = DV_Department;
DDL_Management.DataTextField = "DepartmentName"; DDL_Management.DataValueField = "DepartmentID";
DDL_Management.DataBind();
}
catch
{
}
}
ASKER
we need bootstrap and jQuery
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.