AjaxModalPopup don't show on visual studio 2013 - asp.net

I'm working on simple asp.net project with master page and content page. On the content page I have a ImageButton inside a gridview. I'm trying to show a modal popup when I click Image button, but it does not appear.
This is the necessary code:
<asp:Button ID="showPopUp" runat="server" Text="Button" Visible="False" />
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" style="display:none">
<table class="nav-justified">
<tr>
<td colspan="3" style="background-color: #CCCC00; color: #FFFFFF;" title="Purchase Invoice Details"></td>
</tr>
<tr>
<td class="auto-style5">Invoice</td>
<td class="auto-style6">:</td>
<td class="auto-style13">
<asp:Label ID="lblInvoice" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style12">Name</td>
<td class="auto-style8">:</td>
<td class="auto-style14">
<asp:Label ID="lblName" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style12">Category</td>
<td class="auto-style8">:</td>
<td class="auto-style14">
<asp:Label ID="lblCategory" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style5">Total Qty</td>
<td class="auto-style6">:</td>
<td class="auto-style13">
<asp:Label ID="lblQuantity" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style12">Total Price</td>
<td class="auto-style8">:</td>
<td class="auto-style14">
<asp:Label ID="lblPrice" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style12">SalePrice/Item</td>
<td class="auto-style8">:</td>
<td class="auto-style14">
<asp:Label ID="lblSalePrice" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style12">Comments</td>
<td class="auto-style8">:</td>
<td class="auto-style14">
<asp:Label ID="lblComments" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style12">Date</td>
<td class="auto-style8">:</td>
<td class="auto-style14">
<asp:Label ID="lblDate" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style12"></td>
<td class="auto-style8"></td>
<td class="auto-style14"></td>
</tr>
<tr>
<td colspan="3" style="height: 20px">
<asp:Button ID="btnClose" CssClass="btn-info" runat="server" Text="Close" OnClick="btnClose_Click" />
</td>
</tr>
</table>
</asp:Panel>
<ajax:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="showPopUp"
PopupControlID="Panel1"
CancelControlID="btnClose"
BackgroundCssClass="backgroundcss" >
</ajax:ModalPopupExtender>
<style type="text/css">
.backgroundcss{
background-color:gray;
filter:alpha(opacity=80);
opacity:0.8;
z-index:10000;
}
.modalPopup
{
background-color: #FFFFFF;
width: 300px;
border: 3px solid #0DA9D0;
padding: 0;
}
</style>
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
ImageButton imgbtn = (ImageButton)sender;
GridViewRow gvr = (GridViewRow)imgbtn.NamingContainer;
lblInvoice.Text = gvr.Cells[1].Text;
lblName.Text = gvr.Cells[2].Text;
lblCategory.Text = gvr.Cells[3].Text;
lblQuantity.Text = gvr.Cells[4].Text;
lblPrice.Text = gvr.Cells[5].Text;
lblSalePrice.Text = gvr.Cells[6].Text;
lblComments.Text = gvr.Cells[7].Text;
lblDate.Text = gvr.Cells[8].Text;
this.ModalPopupExtender1.Show();
}

I was setting the targetcontrolid of the extender to a hidden button and trying to fire the Show() event in server side code. It wasn't being displayed even though the code was getting hit. I discovered that the problem was that I was hiding the hidden button using "visible = false" which doesn't render the control to the page. I changed it to "style='display:none'" and it started working. Try changing your target control to a hidden button and make sure it's getting rendered and maybe it will work.

Related

asp.net TextBox not updating in IE11

I have migrated my .net projet from framework 3.5 to 4.5 and my the site was previously running under IE7.
I need to run it under IE11 now. I have a page which upon selecting an element in a dropdown display the values of the element selected.
The element has 3 different fields:
Code, name and info et a button delete which upon clicking delete the element and empty the fields.
Below is the code which does the reset:
protected void LB_Supprimer_Click(object sender, System.EventArgs e)
{
if ( this.DBDelete_TRF() )
{
this.TB_NOM.Text = "" ;
this.TB_CODE.Text = "" ;
this.TB_ACTCORR.Text = "" ;
}
MngMessage.refresh();
}
Code in aspx:
<TABLE id="Table1" borderColor="lightgrey" cellSpacing="5" cellPadding="0" width="100%"
border="0">
<TR>
<TD style="WIDTH: 168px; HEIGHT: 19px" align="right">
<asp:Label id="Lbl_code" runat="server" CssClass="label" DESIGNTIMEDRAGDROP="47">Code : </asp:Label></TD>
<TD style="WIDTH: 403px; HEIGHT: 19px">
<asp:TextBox id="TB_CODE" runat="server" Width="96px" CssClass="txt" DESIGNTIMEDRAGDROP="73"
ToolTip="Code" Font-Bold="True" ontextchanged="TB_CODE_TextChanged"></asp:TextBox>
</TD>
</TR>
<TR>
<TD style="WIDTH: 168px; HEIGHT: 68px" align="right">
<asp:Label id="Label_Nom" runat="server" CssClass="label" DESIGNTIMEDRAGDROP="86">Nom : </asp:Label></TD>
<TD style="WIDTH: 403px; HEIGHT: 68px">
<asp:TextBox id="TB_NOM" runat="server" Height="54px" Width="360px" CssClass="txt" DESIGNTIMEDRAGDROP="85"
Font-Bold="True" TextMode="MultiLine" Rows="4"></asp:TextBox></TD>
</TR>
<TR>
<TD style="WIDTH: 168px" align="right"></TD>
<TD style="WIDTH: 403px">
<asp:Label id="LB_INFO" runat="server" CssClass="label">Info</asp:Label></TD>
</TR>
<TR>
<TD style="WIDTH: 168px" align="right">
<asp:Label id="Label8" runat="server" CssClass="label" DESIGNTIMEDRAGDROP="49">Action : </asp:Label>
<asp:CheckBox id="chk_Confirmee" runat="server" CssClass="DBLabel" ToolTip="xxx yyy"
Text="Confirmée"></asp:CheckBox></TD>
<TD style="WIDTH: 403px">
<asp:TextBox id="TB_ACTCORR" runat="server" Height="74px" Width="360px" CssClass="txt" TextMode="MultiLine"
Rows="5"></asp:TextBox></TD>
</TR>
<TR>
<TD align="center" height="15"><cc1:linkbutton id="LB_Supprimer" runat="server" DisableText="Traitement en cours" DisableAfterClick="True" onclick="LB_Supprimer_Click">Supprimer</cc1:linkbutton></TD>
</TR>
</TABLE>
The above does not work in IE11 only but in chrome it does.
Any idea how to solve this pls?

Not able to see radio button list in my screen

I am unable to see the radio button list yes or NO in my screen I am getting the values from XML file.
Following code in aspx page:
<asp:Panel ID="pnlAction" runat="server" Width="100%" Visible="false">
<table cellpadding="0" cellspacing="0" border="0" width="99%">
<tr style="height: 20px;">
<td style="width: 25px;">
<hr />
</td>
<td class="secHeading frmlblBold"" style="width: 80px;" align="center">
Action
</td>
<td>
<hr />
</td>
</tr>
</table>
<table style="font-weight:normal" width="100%" border="0" cellpadding="2" cellspacing="2">
<tr>
<td style="width:250px;"></td>
<td style="width:350px;"></td>
<td style="width:250px;"></td>
<td style="width:350px;"></td>
</tr>
<tr>
<td class="frmlblBold" style="text-align:right;vertical-align:top">Action </td>
<td><asp:DropDownList ID="ddlAction" runat="server" CssClass="DropDown" DataSourceID="dsAction" DataValueField="CODE" DataTextField="CDDesc" AutoPostBack = "False" Width="342px"></asp:DropDownList></td>
</tr>
<tr>
<td class="frmlblBold" style="text-align:right;vertical-align:top">Service Agreement Clause </td>
<td style="vertical-align:top" style="width: 350px;">
<%-- <fieldset id="fldSLA" runat="server" style="width: 280px;">--%>
<asp:RadioButtonList ID="radSLA" runat="server" RepeatDirection="Horizontal" DataValueField="SLAID" DataTextField="SLADESC" DataSourceID="dsSLA" visible = "true">
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="rfvSLA" runat="server" ControlToValidate="radSLA" ErrorMessage="Please select if service agreement is applicable or not."
Enabled="true" Display="none"></asp:RequiredFieldValidator>
<%-- </fieldset>--%>
</td>
</tr>
<tr>
<td class="frmlblBold" style="text-align:right;vertical-align:top">Comments </td>
<td style="vertical-align:top">
<asp:TextBox runat="server" ID="txtActionComments" MaxLength="500" TextMode="MultiLine" width="95%" Rows="5" /> </td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" CssClass="btnOther" />
</tr>
</asp:Panel>
<asp:XmlDataSource ID="dsSLA" runat="server" EnableCaching="false" DataFile="~/XML/VisaTracking.xml"
XPath="BVILetter/SLA/ITEM" />
Code in .cs file:
if (!IsPostBack)
{
base.PageLoad();
GetReqPndActTknByMe(base.LogShortID);
radSLA.DataBind();
radSLA.SelectedValue = "Yes";
BindDataToDropdownListAction();
}
I am able to see the row count of radSLA.DataBind(); as '2'
My XML code:
<BVILetter>
<SLA>
<ITEM SLAID ="Yes" SLADESC ="Yes" />
<ITEM SLAID ="No" SLADESC ="No" />
</SLA>
</BVILetter>
But I am not able to see the radio buttons in my screen:
Please help me.
Please Check the Binding function clearly. If binding not happened properly then RadioBottonList does not appear.RadioBottonList apear only when when listItem bind properly

UpdatePanel alignment issue inside the Table

I am using UpdatePanel control in the middle of the page for partial postback of Address Type radio button change. Everything works fine but I am struggling with alignment issue. The controls inside the UpdatePanel do not align with outside controls. How could I solve this issue? Please let me know.
<table id="tblEdit" class="cssclass1" cellpadding="3" runat="server">
<tr>
<td class="cssclass1" align="right">
Title
</td>
<td>
<telerik:RadTextBox ID="textbox1" runat="server" Width="280px" ReadOnly="true"
BackColor="LightGray" />
</td>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblFirstName" runat="server">First Name</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtFirstName" runat="server" MaxLength="30">
</telerik:RadTextBox>
<asp:Image ID="Image1" ImageUrl="../../../images/requiredfield.gif" AlternateText="Required Field"
runat="server"></asp:Image><asp:HiddenField ID="hfCaseEntityId" runat="server" />
</td>
</tr>
<tr>
<td colspan="4">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<tr>
<td class="cssclass1" align="right">
Address Type
</td>
<td align="left">
<asp:RadioButtonList ID="AddressType" runat="server" RepeatDirection="Horizontal" OnSelectedIndexChanged="AddressType_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem Value="1" Selected="True">Home</asp:ListItem>
<asp:ListItem Value="2">Work</asp:ListItem>
</asp:RadioButtonList>
</td>
<td class="cssclass1" align="right">
</td>
<td align="left">
</td>
</tr>
<tr>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblHomeStreet1" runat="server">Address</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtHomeStreet1" runat="server" MaxLength="40" >
</telerik:RadTextBox>
<asp:Image ID="Image10" ImageUrl="../../../images/requiredfield.gif" AlternateText="Required Field"
runat="server"></asp:Image>
</td>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblHomeStreet2" runat="server">Street 2</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtHomeStreet2" runat="server" MaxLength="40" Width="280px">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblHomeCity" runat="server">City</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtHomeCity" runat="server" MaxLength="30">
</telerik:RadTextBox>
</td>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblHomeState" runat="server">State</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtHomeState" runat="server" MaxLength="30">
</telerik:RadTextBox>
</td>
</tr>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
Your HTML is invalid. The first line in your <ContentTemplate> is a <tr>, however, it looks like you are trying to include another <table> there. You might want to look into cellpading=0 and cellspacing=0 on your inner table. Also, you could add a CSSClass to your UpdatePanel to do any additional formatting.

Modal popup extender not displaying popup

I have inherited some code using an ASP modal popup extender and for some reason it has now decided to stop working. Am I missing anything here? I'm not too fluent with AJAX / ASP.Net right now so im struggling to diagnose what is going wrong here.
So firstly the javascript method that displays the modal
function ShowModalRemoveEvent(ID, EventID, InstructorID, InstructorName)
{
alert("Hi");
var modal = $find('ModalPopupExtender1');
modal.show();
document.getElementById("txtID").value = ID;
document.getElementById("txtEventID").value = EventID;
document.getElementById("txtInstructorID").value = InstructorID;
document.getElementById("txtInstructorName").value = InstructorName;
}
I know this is being called because of the alert. So I would assume the prpblem is either in finding the ModalPopupExtender1 or the modal.show() line.
Here is the code for my modal popup extender
<asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="Panel4" runat="server" Style="display: none" CssClass="ModalBackground">
<table style="width: 100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="7%" class="cellAlertHeader">
<img src="../../../images/Ops/window_delete.png" style="width: 18px; height: 18px" alt=""/>
</td>
<td width="93%" class="cellAlertHeader">
<b>Cancel Instructor Event</b>
</td>
</tr>
</table>
<table width="100%">
<tr>
<td width="5%">
<td width="95%">
<asp:TextBox ID="txtID" Style="display: none" runat="server" CssClass="TextboxTitle"></asp:TextBox>
<asp:TextBox ID="txtEventID" Style="display: none" runat="server" CssClass="TextboxTitle"></asp:TextBox>
</td>
</tr>
<tr>
<td width="5%">
</td>
<td width="95%">
<asp:TextBox ID="txtInstructorID" Style="display: none" runat="server" BorderStyle="None"
CssClass="TextboxTitle"></asp:TextBox>
<asp:TextBox ID="txtInstructorName" Style="font-size: 12px" runat="server" BorderStyle="None"
CssClass="TextboxTitle" BorderWidth="0"></asp:TextBox>
</td>
</tr>
<tr>
<td width="5%">
</td>
<td width="95%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td width="95%">
<asp:Label ID="Label2" runat="server" Text="Are you sure you want to remove this Event?"
CssClass="TextboxTitle"></asp:Label>
</td>
</tr>
<tr>
<td width="5%">
</td>
<td width="95%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td width="95%">
<asp:Button ID="ButtonConfirmRemove" runat="server" Text="Confirm" CssClass="buttonshort" />
<asp:Button ID="ButtonCancel" runat="server" Text="Cancel" CssClass="buttonshort" />
</td>
</tr>
<tr>
<td width="5%">
</td>
<td width="95%">
</td>
</tr>
</table>
</asp:Panel>
<asp:Button runat="server" ID="dummyButton" Style="display: none" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1"
runat="server"
PopupControlID="Panel4"
TargetControlID="dummyButton"
BackgroundCssClass="ModalBGOpacity"
CancelControlID="ButtonCancel"
OnCancelScript="HideModalPopup()">
</cc1:ModalPopupExtender>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="dummyButton" />
</Triggers>
</asp:UpdatePanel>
Try getting the rendered id of your control, like that.
var modal = $find('<%=ModalPopupExtender1.CliendID%>');

modal popup in asp.net

i am using model popup in asp.net on this linkbutton
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="addProduct-disable" Enabled ="false" Text="Assign Filter Criteria" CausesValidation="true" ></asp:LinkButton>
when i click a button in popup the event is getting fired but the asp panel and label are not getting displayed
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="3" class="style3" align="center">
Assign Filtering Criteria
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="lblSuccess" runat="server" Text="" ></asp:Label>
</td>
</tr>
<tr>
<td class="logText" width="30%">
Filter:
<asp:ImageButton ID="imgFilter" runat="server" ImageUrl="../images/helpIcon.png"
border="0" CausesValidation="false" OnClientClick="return showHelp('ctl00_ContentPlaceHolder1_pnlFilterHelp');" />
<cc1:ModalPopupExtender ID="mdlFilter" runat="server" TargetControlID="imgFilter"
PopupControlID="pnlFilterHelp" DropShadow="false" CancelControlID="lnkFilterCancel"
X="410" Y="200" />
<asp:Panel ID="pnlFilterHelp" runat="server" Height="70px" Width="170px" Style="display: none;">
<asp:Panel ID="pnlFilterOuter" runat="server" CssClass="modalPopup2" Height="100px"
Width="180px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" BackColor="#FFFCF9">
<table cellpadding="0" cellspacing="0" width="90%">
<tr>
<td align="center" valign="middle" style="padding-top: 15px; padding-left: 5px;">
<table cellpadding="0" align="center" cellspacing="0" width="100%" height="40px">
<tr>
<td class="style8">
Set Filter Criteria so that customer can easily search product.
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td style="padding-left: 20px;">
<asp:LinkButton ID="lnkFilterCancel" runat="server" Text="" CssClass="gridPagerlink"
ForeColor="Black">Close <b>X</b></asp:LinkButton>
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
</td>
<td width="4px">
</td>
<td class="logBox">
<asp:UpdatePanel ID="filter" runat="server">
<ContentTemplate>
<asp:DropDownList ID="drpFilter" runat="server" AutoPostBack="True" OnSelectedIndexChanged="drpFilter_SelectedIndexChanged"
Width="150px">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td class="logText">
Filter Option:
<asp:ImageButton ID="imgFilterOption" runat="server" ImageUrl="../images/helpIcon.png"
border="0" CausesValidation="false" OnClientClick="return showHelp('ctl00_ContentPlaceHolder1_pnlFilterOption');" />
<cc1:ModalPopupExtender ID="mdlFilterOption" runat="server" TargetControlID="imgFilterOption"
PopupControlID="pnlFilterOption" DropShadow="false" CancelControlID="lnkFilterOptionCancel"
X="410" Y="220" />
<asp:Panel ID="pnlFilterOption" runat="server" Height="70px" Width="170px" Style="display: none;">
<asp:Panel ID="pnlFilterOptionOuter" runat="server" CssClass="modalPopup2" Height="300px"
Width="580px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" BackColor="#FFFCF9">
<table cellpadding="0" cellspacing="0" width="90%">
<tr>
<td align="center" valign="middle" style="padding-top: 15px; padding-left: 5px;">
<table cellpadding="0" align="center" cellspacing="0" width="100%" height="40px">
<tr>
<td class="style8">
Set Filter Criteria Option so that customer can easily search product.
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td style="padding-left: 20px;">
<asp:LinkButton ID="lnkFilterOptionCancel" runat="server" Text="" CssClass="gridPagerlink"
ForeColor="Black">Close <b>X</b></asp:LinkButton>
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
</td>
<td width="4px">
</td>
<td class="logBox">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="drpFilterOption" runat="server" Width="150px" Enabled="false">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td class="logText">
</td>
<td width="4px">
</td>
<td class="logBox">
<asp:UpdatePanel ID="cancel" runat="server">
<ContentTemplate>
<asp:Button ID="btnAdd" runat="server" Style="font-weight: 700; text-align: right"
Text="Add" CssClass="Login-btn" OnClick="btnAdd_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</td> </tr>
<tr>
<td>
</td>
<td colspan="2">
</td>
</tr>
<tr>
<td align="center" colspan="3">
<asp:Panel ID="pnlAddFilter" runat="server" style="display:none">
<table id="list">
</table>
<div id="pager" style="text-align: center;">
</div>
<br />
</asp:Panel>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
</tr>
</table>
event is
protected void btnAdd_Click(object sender, EventArgs e)
{
pnlAddFilter.Style.Add("display", "block");
//pnlAddFilter.Visible = true;
DataTable dtFilter = new DataTable();
dtFilter.Columns.Add("FOId");
dtFilter.Columns.Add("Filtername");
dtFilter.Columns.Add("FilterOption");
DataRow drFilter;
if (Session["Filter"] != null)
{
dtFilter = (DataTable)Session["Filter"];
}
drFilter = dtFilter.NewRow();
drFilter["FOId"] = drpFilterOption.SelectedValue;
drFilter["Filtername"] = drpFilter.SelectedItem.Text;
drFilter["FilterOption"] = drpFilterOption.SelectedItem.Text;
dtFilter.Rows.Add(drFilter);
Session["Filter"] = dtFilter;
btnAdd.Enabled = false;
if (Session["Filter"] == null)
{
// pnlAddFilter.Visible = false;
pnlAddFilter.Style.Add("display", "none");
}
else
{
pnlAddFilter.Style.Add("display", "block");
// pnlAddFilter.Visible = true;
}
lblSuccess.Visible = true;
lblSuccess.Text = AppHardcodeValue.strAddFilterProduct;
}
In my experience, the modal popup doesn't support dynamically rendered data very well. I'm thinking you probably need to put your modal content inside of an update panel in order to be able to use the server side code to update the label.

Resources