ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Increase Height and Width of ModalPopupExtender using CSS in ASP.Net<p>Hi <a class="username" rel="akhter"> akhter</a>,</p> <p>You need to change your css file by taking below css code.</p> <p>Refer below sample.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head id=&#34;Head1&#34; runat=&#34;server&#34;&gt; &lt;title&gt;GridView Add, Edit, Delete AJAX Way&lt;/title&gt; &lt;link href=&#34;CSS/CSS.css&#34; rel=&#34;stylesheet&#34; type=&#34;text/css&#34; /&gt; &lt;script src=&#34;scripts/jquery-1.3.2.min.js&#34; type=&#34;text/javascript&#34;&gt;&lt;/script&gt; &lt;script src=&#34;scripts/jquery.blockUI.js&#34; type=&#34;text/javascript&#34;&gt;&lt;/script&gt; &lt;/head&gt; &lt;body style=&#34;margin: 0; padding: 0&#34;&gt; &lt;form id=&#34;form1&#34; runat=&#34;server&#34;&gt; &lt;asp:ScriptManager ID=&#34;ScriptManager1&#34; runat=&#34;server&#34;&gt; &lt;/asp:ScriptManager&gt; &lt;asp:UpdatePanel ID=&#34;UpdatePanel1&#34; runat=&#34;server&#34;&gt; &lt;ContentTemplate&gt; &lt;asp:GridView ID=&#34;GridView1&#34; runat=&#34;server&#34; Width=&#34;550px&#34; AutoGenerateColumns=&#34;false&#34; AlternatingRowStyle-BackColor=&#34;#C2D69B&#34; HeaderStyle-BackColor=&#34;green&#34; AllowPaging=&#34;true&#34; OnPageIndexChanging=&#34;OnPaging&#34; PageSize=&#34;10&#34;&gt; &lt;Columns&gt; &lt;asp:BoundField DataField=&#34;EnrollNumber&#34; HeaderText=&#34;Employee ID&#34; HtmlEncode=&#34;true&#34; /&gt; &lt;asp:BoundField DataField=&#34;EmpName&#34; HeaderText=&#34;Employee Name&#34; HtmlEncode=&#34;true&#34; /&gt; &lt;asp:BoundField DataField=&#34;FatherName&#34; HeaderText=&#34;Father Name&#34; HtmlEncode=&#34;true&#34; /&gt; &lt;asp:BoundField DataField=&#34;SecNam&#34; HeaderText=&#34;Section&#34; HtmlEncode=&#34;true&#34; /&gt; &lt;asp:BoundField DataField=&#34;JoinDate&#34; HeaderText=&#34;Join Date&#34; HtmlEncode=&#34;true&#34; /&gt; &lt;asp:TemplateField ItemStyle-Width=&#34;30px&#34; HeaderText=&#34;CustomerID&#34;&gt; &lt;ItemTemplate&gt; &lt;asp:LinkButton ID=&#34;lnkEdit&#34; runat=&#34;server&#34; Text=&#34;Edit&#34; OnClick=&#34;Edit&#34;&gt;&lt;/asp:LinkButton&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;AlternatingRowStyle BackColor=&#34;#C2D69B&#34; /&gt; &lt;/asp:GridView&gt; &lt;asp:Button ID=&#34;btnAdd&#34; runat=&#34;server&#34; Text=&#34;Add&#34; /&gt; &lt;asp:Panel ID=&#34;pnlAddEdit&#34; runat=&#34;server&#34; CssClass=&#34;modalPopup&#34; Style=&#34;display: none&#34;&gt; &lt;br /&gt; &lt;table align=&#34;center&#34;&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID=&#34;Label1&#34; runat=&#34;server&#34; Text=&#34;EnrollNumber&#34;&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID=&#34;txtEnrollNumber&#34; Width=&#34;40px&#34; MaxLength=&#34;5&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID=&#34;Label2&#34; runat=&#34;server&#34; Text=&#34;EmpName&#34;&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID=&#34;txtEmpName&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID=&#34;Label3&#34; runat=&#34;server&#34; Text=&#34;FatherNam&#34;&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID=&#34;txtFatherNam&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID=&#34;Label5&#34; runat=&#34;server&#34; Text=&#34;SecName&#34;&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:DropDownList ID=&#34;ddlSecID&#34; runat=&#34;server&#34;&gt; &lt;asp:ListItem Text=&#34;Select&#34; Value=&#34;0&#34; /&gt; &lt;asp:ListItem Text=&#34;Baby&#34; /&gt; &lt;asp:ListItem Text=&#34;Lazy&#34; /&gt; &lt;/asp:DropDownList&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID=&#34;Label6&#34; runat=&#34;server&#34; Text=&#34;JoinDate&#34;&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID=&#34;txtJoinDate&#34; runat=&#34;server&#34; ReadOnly=&#34;true&#34;&gt;&lt;/asp:TextBox&gt; &lt;cc1:CalendarExtender ID=&#34;txtrechargedate_CalendarExtender&#34; runat=&#34;server&#34; Enabled=&#34;True&#34; TargetControlID=&#34;txtJoinDate&#34; PopupPosition=&#34;BottomLeft&#34;&gt; &lt;/cc1:CalendarExtender&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Button ID=&#34;btnSave&#34; runat=&#34;server&#34; Text=&#34;Save&#34; OnClick=&#34;Save&#34; /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:Button ID=&#34;btnCancel&#34; runat=&#34;server&#34; Text=&#34;Cancel&#34; OnClientClick=&#34;return Hidepopup()&#34; /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;asp:LinkButton ID=&#34;lnkFake&#34; runat=&#34;server&#34;&gt;&lt;/asp:LinkButton&gt; &lt;cc1:ModalPopupExtender ID=&#34;popup&#34; runat=&#34;server&#34; DropShadow=&#34;false&#34; PopupControlID=&#34;pnlAddEdit&#34; TargetControlID=&#34;lnkFake&#34; BackgroundCssClass=&#34;modalBackground&#34;&gt; &lt;/cc1:ModalPopupExtender&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID=&#34;GridView1&#34; /&gt; &lt;asp:AsyncPostBackTrigger ControlID=&#34;btnSave&#34; /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(document).ready(function () { BlockUI(&#34;&lt;%=pnlAddEdit.ClientID %&gt;&#34;); $.blockUI.defaults.css = {}; }); function Hidepopup() { $find(&#34;popup&#34;).hide(); return false; } function BlockUI(elementID) { var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_beginRequest(function () { $(&#34;#&#34; + elementID).block({ message: &#39;&lt;table align=&#34;center&#34;&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=&#34;images/loadingAnim.gif&#34;/&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#39;, css: {}, overlayCSS: { backgroundColor: &#39;#000000&#39;, opacity: 0.6 } }); }); prm.add_endRequest(function () { $(&#34;#&#34; + elementID).unblock(); }); } &lt;/script&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><span style="text-decoration: underline;"><strong>CSS</strong></span></p> <pre class="brush: css">body { font-family: Arial; font-size: 10pt; } .modalBackground { background-color: Black; filter: alpha(opacity=90); opacity: 0.8; } .modalPopup { background-color: #FFFFFF; border-width: 3px; border-style: solid; border-color: black; padding-top: 10px; padding-left: 10px; width: 500px; height: 540px; }</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Data;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Data</pre> <p>&nbsp;</p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.BindData(); } } private void BindData() { GridView1.DataSource = GetData(); GridView1.DataBind(); } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[] { new DataColumn(&#34;EnrollNumber&#34;, typeof(int)), new DataColumn(&#34;EmpName&#34;, typeof(string)), new DataColumn(&#34;FatherName&#34;, typeof(string)), new DataColumn(&#34;SecNam&#34;, typeof(string)), new DataColumn(&#34;JoinDate&#34;, typeof(DateTime)) }); dt.Rows.Add(1, &#34;Mudassar Khan&#34;, &#34;ABCD&#34;, &#34;Baby&#34;, DateTime.Now); dt.Rows.Add(2, &#34;Joh Hammod&#34;, &#34;EFG&#34;, &#34;Lazy&#34;, DateTime.Now.AddDays(1)); dt.Rows.Add(2, &#34;Robert&#34;, &#34;RDJ&#34;, &#34;Daddy&#34;, DateTime.Now.AddDays(2)); GridView1.DataSource = dt; return dt; } protected void OnPaging(object sender, GridViewPageEventArgs e) { this.BindData(); GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind(); } protected void Edit(object sender, EventArgs e) { using (GridViewRow row = (GridViewRow)((LinkButton)sender).Parent.Parent) { txtEnrollNumber.Text = row.Cells[0].Text; txtEmpName.Text = row.Cells[1].Text; txtFatherNam.Text = row.Cells[2].Text; ddlSecID.ClearSelection(); if (ddlSecID.Items.FindByText(row.Cells[3].Text) != null) { ddlSecID.Items.FindByText(row.Cells[3].Text).Selected = true; } txtJoinDate.Text = Convert.ToDateTime(row.Cells[4].Text).ToString(&#34;dd/MM/yyyy&#34;); popup.Show(); } } protected void Save(object sender, EventArgs e) { string date = Request.Form[txtJoinDate.UniqueID]; }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) If Not IsPostBack Then Me.BindData() End If End Sub Private Sub BindData() GridView1.DataSource = GetData() GridView1.DataBind() End Sub Private Function GetData() As DataTable Dim dt As DataTable = New DataTable() dt.Columns.AddRange(New DataColumn() {New DataColumn(&#34;EnrollNumber&#34;, GetType(Integer)), New DataColumn(&#34;EmpName&#34;, GetType(String)), New DataColumn(&#34;FatherName&#34;, GetType(String)), New DataColumn(&#34;SecNam&#34;, GetType(String)), New DataColumn(&#34;JoinDate&#34;, GetType(DateTime))}) dt.Rows.Add(1, &#34;Mudassar Khan&#34;, &#34;ABCD&#34;, &#34;Baby&#34;, DateTime.Now) dt.Rows.Add(2, &#34;Joh Hammod&#34;, &#34;EFG&#34;, &#34;Lazy&#34;, DateTime.Now.AddDays(1)) dt.Rows.Add(2, &#34;Robert&#34;, &#34;RDJ&#34;, &#34;Daddy&#34;, DateTime.Now.AddDays(2)) GridView1.DataSource = dt Return dt End Function Protected Sub OnPaging(ByVal sender As Object, ByVal e As GridViewPageEventArgs) Me.BindData() GridView1.PageIndex = e.NewPageIndex GridView1.DataBind() End Sub Protected Sub Edit(ByVal sender As Object, ByVal e As EventArgs) Using row As GridViewRow = CType((CType(sender, LinkButton)).Parent.Parent, GridViewRow) txtEnrollNumber.Text = row.Cells(0).Text txtEmpName.Text = row.Cells(1).Text txtFatherNam.Text = row.Cells(2).Text ddlSecID.ClearSelection() If ddlSecID.Items.FindByText(row.Cells(3).Text) IsNot Nothing Then ddlSecID.Items.FindByText(row.Cells(3).Text).Selected = True End If txtJoinDate.Text = Convert.ToDateTime(row.Cells(4).Text).ToString(&#34;dd/MM/yyyy&#34;) popup.Show() End Using End Sub Protected Sub Save(ByVal sender As Object, ByVal e As EventArgs) Dim date As String = Request.Form(txtJoinDate.UniqueID) End Sub</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/191463/Increase-Height-and-Width-of-ModalPopupExtender-using-CSS-in-ASPNet/https://www.aspforums.net:443/Threads/191463/Increase-Height-and-Width-of-ModalPopupExtender-using-CSS-in-ASPNet/Wed, 11 Sep 2019 03:12:15 GMT