Adding two ajax modal popup in a single page - c#

I encountered a problem where i add two ajax modal popup in a single page. This two modal popup each do different things. one is is create and one is for update. When two modal popup, my update button cannot be click ans execute the update codes. And when i remove my create modal popup, my updates work? Can anyone tell me how do i make two popup exist in the same page?
<!--Modal Popup: Create Topic-->
<cc1:modalpopupextender ID="ModalPopupExtender1" runat="server"
TargetControlID="btnShowPopup" PopupControlID="pnlCreatePopup"
CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
</cc1:modalpopupextender>
<asp:Panel ID="pnlCreatePopup" runat="server" CssClass="createModalPopup">
<!--Modal Popup: Update Topic-->
<asp:Button ID="bnUpdateShow" runat="server" style="display:none;" />
<cc1:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="bnUpdateShow" PopupControlID="pnlpopup" CancelControlID="btnUpdateCancel" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" CssClass="topicModalPopup">

I solved this hiding the ajax pop up inside a panel configured as visible=false. I fire the popUp in codeBehind. here is some code:
<asp:LinkButton runat="server" ID="lbCredits1" Font-Underline="true"
CausesValidation="false" OnClick="btMpeCredits_Click">Credits</asp:LinkButton>
|
<asp:LinkButton runat="server" ID="lbPrivacy2" Font-Underline="true"
CausesValidation="false" OnClick="btMpePrivacy_Click">Privacy</asp:LinkButton>
<%--AjaxPopUpExtenderArea--%>
<asp:Panel ID="pnlAjaxArea" runat="server" Visible="false">
<%--PrivacyMPE--%>
<%--I have to hide the link button referenced in the AjaxPopUpExtender. I will use a different button to show the pop up--%>
<div style="display:none;">
<asp:LinkButton runat="server" ID="lbPrivacy" Text="PRIVACY"/>
</div>
<asp:ModalPopupExtender ID="MpePrivacy" runat="server" TargetControlID="lbPrivacy"
PopupControlID="PnlPrivacy" BackgroundCssClass="modalBackground" >
</asp:ModalPopupExtender>
<asp:Panel runat="server" ID="PnlPrivacy" Height="500px" Width="600px" BorderStyle="Solid"
BorderColor="#1E549E" BorderWidth="3px" BackColor="#FFFFFF" ScrollBars="Auto">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<UcPrivacy:Privacy runat="server" ID="Privacy" />
</td>
</tr>
<tr>
<td align="center">
<asp:ImageButton ImageUrl="~/App_Themes/GfRegistrationPage/images/chiudi-btn.gif" runat="server" OnClick="btMpeClose"
CausesValidation="False" />
<br />
<br />
</td>
</tr>
</table>
</asp:Panel>
<%--CreditsMPE--%>
<div style="display:none;">
<asp:LinkButton runat="server" ID="lbCredits" Text="credits"/>
</div>
<asp:ModalPopupExtender ID="MpeCredits" runat="server" TargetControlID="lbCredits"
PopupControlID="PnlCredits" BackgroundCssClass="modalBackground" >
</asp:ModalPopupExtender>
<asp:Panel runat="server" ID="PnlCredits" Height="500px" Width="600px" BorderStyle="Solid"
BorderColor="#1E549E" BorderWidth="3px" BackColor="#FFFFFF" ScrollBars="Auto">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<UcCredits:Credits runat="server" ID="Credits" />
</td>
</tr>
<tr>
<td align="center">
<asp:ImageButton ImageUrl="~/App_Themes/GfRegistrationPage/images/chiudi-btn.gif" runat="server" OnClick="btMpeClose"
CausesValidation="False" />
<br />
<br />
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
and here some code behind:
#region ModalPopUpS Privacy credits
protected void btMpePrivacy_Click(object sender, EventArgs e)
{
pnlAjaxArea.Visible = true;
AjaxControlToolkit.ModalPopupExtender modalPop = ((AjaxControlToolkit.ModalPopupExtender)(this.Master.FindControl("ContentPlaceHolder1").FindControl("MpePrivacy")));
modalPop.Show();
}
protected void btMpeCredits_Click(object sender, EventArgs e)
{
pnlAjaxArea.Visible = true;
AjaxControlToolkit.ModalPopupExtender modalPop = ((AjaxControlToolkit.ModalPopupExtender)(this.Master.FindControl("ContentPlaceHolder1").FindControl("MpeCredits")));
modalPop.Show();
}
protected void btMpeClose(object sender, EventArgs e)
{
pnlAjaxArea.Visible = false;
}
#endregion

Related

ASP.NET (C#) - ListView

In past, i worked on ListViews (.net 2.0) using a custom Template field but what i am trying to achieve here is the following
I am now working on .net 4.6
So basically a list which shows items like above and on mouse-hover few options show up as shown in the following screenshot
I also have to trigger those option to do different things -
How can I do that in asp.net, may I please have some code references.
Cheers
P.S.
This is a rough example of how i am creating the List Item Template (as requested)
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
<AlternatingItemTemplate>
<table >
<tr>
<td ><asp:Image ID="image1" ImageUrl='<%# Bind("url") %>' runat="server" Width="98px" /> </td>
<td><h2><asp:Label ID="_label" runat="server" Text ='<%# Bind("title") %>'></asp:Label></h2><asp:Label ID="Label1" runat="server" Text ='<%# Bind("description") %>'></asp:Label></td>
</tr>
</table>
</AlternatingItemTemplate>
<EmptyDataTemplate>
No data was returned.
</EmptyDataTemplate>
<ItemSeparatorTemplate>
<br />
</ItemSeparatorTemplate>
<ItemTemplate>
<table >
<tr>
<td ><asp:Image ID="image1" ImageUrl='<%# Bind("url") %>' runat="server" Width="98px" /> </td>
<td><h2><asp:Label ID="_label" runat="server" Text ='<%# Bind("title") %>'></asp:Label></h2><asp:Label ID="Label1" runat="server" Text ='<%# Bind("description") %>'></asp:Label></td>
</tr>
</table>
</ItemTemplate>
<LayoutTemplate>
<ul id="itemPlaceholderContainer" runat="server" style="">
<li runat="server" id="itemPlaceholder" />
</ul>
<div style="">
</div>
</LayoutTemplate>
</asp:ListView>
I can add any html formatting to this template e,g i can add ASP:button etc but i don't know how to trigger those to perform certain tasks.
One easy way to achieve your requirement is to keep those buttons there but invisible and show them up when the parent container is hovered. following as a quick sample
aspx
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<tr class="row-data">
<td>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</td>
<td>
<asp:Label ID="PositionLabel" runat="server" Text='<%# Eval("Position") %>' />
</td>
<td>
<div class="btn-area">
<asp:Button runat="server" Text="Button1" />
<asp:Button runat="server" Text="Button2" />
</div>
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table id="itemPlaceholderContainer" runat="server" border="0" style="">
<tr runat="server" style="">
<th runat="server">
Name
</th>
<th runat="server">
Position
</th>
<th>
</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
css
.btn-area
{
display: none;
}
.row-data:hover .btn-area
{
display: block;
}
code-behind
protected void Page_Load(object sender, EventArgs e)
{
ListView1.DataSource = new List<dynamic>() {
new { Name = "Andy", Position = "PG"},
new { Name = "Bill", Position = "SD"},
new { Name = "Caroline", Position = "Manager"}
};
ListView1.DataBind();
}
UPDATE
ListView ItemCommand can capture the postback by button pressed and CommandName makes you able to recognize which button fired it.
<asp:Button runat="server" Text="Button1" CommandName="c1" />
<asp:Button runat="server" Text="Button2" CommandName="c2" />
code-behind
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "c1")
{
// do something when button1 pressed
}
else if (e.CommandName == "c1")
{
// do something when button2 pressed
}
}

Unable to hide and show panel

I have two panels Panel1 and panel2 when page loads, both panels are hidden. And I have a dropdown list, when I selct dropdown values the panel shoud be visible. Now its not visible as per my dropdown selection. My page load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Panel1.Visible = false;
Panel2.Visible = false;
}
}
Dropdown click function
protected void ddmode_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddmode.SelectedItem.Value == "4")
{
Panel1.Visible = true;
Panel2.Visible = false;
}
}
But now when I select dropdown with value 4 panel1 is not visible. My UI part
<tr>
<td align="left" class="style2">
Mode</td>
<td align="left">
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate >
<div class="input-prepend" title="Select Machine ID" data-rel="tooltip">
<asp:DropDownList ID="ddmode" runat="server" AutoPostBack="True"
onselectedindexchanged="ddmode_SelectedIndexChanged">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ErrorMessage="RequiredFieldValidator" ControlToValidate="ddmode" ForeColor="Red">*
</asp:RequiredFieldValidator>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<asp:Panel ID="Panel1" runat="server">
<tr>
<td align="left" class="style2">
<asp:Label ID="lblfromdate" runat="server" Text="From Date"></asp:Label>
</td>
<td align="left">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="input-prepend" title="Select Date" data-rel="tooltip">
<asp:TextBox ID="txtfromdate" ClientIDMode="Static" runat="server"
TextMode="SingleLine" ></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender2" TargetControlID ="txtfromdate"
Format="dd/MM/yyyy" runat="server">
</ajaxToolkit:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"
ErrorMessage="RequiredFieldValidator"
ControlToValidate="txtfromdate" ForeColor="Red">*</asp:RequiredFieldValidator>
</ContentTemplate></asp:UpdatePanel>
</td>
</tr>
<tr>
<td align="left" class="style2">
<asp:Label ID="lbltodate" runat="server" Text="To Date"></asp:Label>
</td>
<td align="left">
<asp:UpdatePanel ID="UpdatePanel11" runat="server">
<ContentTemplate>
<div class="input-prepend" title="Select Date" data-rel="tooltip">
<asp:TextBox ID="txttodate" ClientIDMode="Static" runat="server"
TextMode="SingleLine" ></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender3" TargetControlID ="txttodate"
Format="dd/MM/yyyy" runat="server">
</ajaxToolkit:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
ErrorMessage="RequiredFieldValidator"
ControlToValidate="txttodate" ForeColor="Red">*</asp:RequiredFieldValidator>
</ContentTemplate></asp:UpdatePanel>
</td>
</tr>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server">
<tr>
<td align="left" class="style2">
<asp:UpdatePanel ID="UpdatePanel14" runat="server">
<ContentTemplate>
<asp:Label ID="lbldept" runat="server" Text="From Department" ></asp:Label>
</ContentTemplate></asp:UpdatePanel>
</td>
<td align="left">
<asp:UpdatePanel ID="UpdatePanel12" runat="server">
<ContentTemplate>
<div class="input-prepend" title="Select Date" data-rel="tooltip">
<asp:TextBox ID="txtfromdept" ClientIDMode="Static" runat="server"
TextMode="SingleLine" ></asp:TextBox>
</ContentTemplate></asp:UpdatePanel>
</td>
</tr>
<tr>
<td align="left" class="style2">
<asp:UpdatePanel ID="UpdatePanel15" runat="server"><ContentTemplate>
<asp:Label ID="lbltodept" runat="server" Text="To Deprtment" ></asp:Label>
</ContentTemplate></asp:UpdatePanel>
</td>
<td align="left">
<asp:UpdatePanel ID="UpdatePanel13" runat="server">
<ContentTemplate>
<div class="input-prepend" title="Select Date" data-rel="tooltip">
<asp:TextBox ID="txttodept" ClientIDMode="Static" runat="server"
TextMode="SingleLine"></asp:TextBox>
</ContentTemplate></asp:UpdatePanel>
</td>
</tr>
</asp:Panel>
In this case, it looks like your dropdownlist is doing a partial postback within updatepanel4 but Panel1 is not in an updatepanel so it can't be updated in a partial postback. Either remove all the updatePanels or place Panel1 in an update panel.
You need to place your panel inside the update panel for it to work. Controls outside update panel cannot work for events of controls inside the update panel.
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate >
<div class="input-prepend" title="Select Machine ID" data-rel="tooltip">
<asp:DropDownList ID="ddmode" runat="server" AutoPostBack="True"
onselectedindexchanged="ddmode_SelectedIndexChanged">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ErrorMessage="RequiredFieldValidator" ControlToValidate="ddmode" ForeColor="Red">*
</asp:RequiredFieldValidator>
<asp:Panel ID="Panel1" runat="server">
....
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>

Button Click Event is not firing but modalpopupextender is working

in my project
i have
<asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
enter code here
Admin - *If Neccesery
<asp:ModalPopupExtender ID="ModalPopupExtender1" PopupControlID="Panel1" TargetControlID="btnAdd"
BackgroundCssClass="modalBackground" runat="server">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" align="center" CssClass="modalPopup" runat="server">
<div class="body-reg-left">
<div class="body-top-reg">
<div class="he-reg">
<b>Admin </b>- *If Neccesery</div>
</div>
<table>
<tr>
<td>
<asp:Label ID="lblCategoryID" runat="server" Text="" CssClass="lbF"></asp:Label>
</td>
<td>
<asp:Label ID="lblstt" runat="server" Text=""></asp:Label>
</td>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Brand Name" CssClass="lbF"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbrdName" runat="server"></asp:TextBox>
</td>
</tr>
</tr>
<tr>
<td>
<asp:Button ID="BtnBrdName" runat="server" Text="Add" Width="70px" OnClick="Button1_Click" />
<asp:Button ID="btncancel" runat="server" Text="Cancel" OnClick="btncancel_Click" />
</td>
</tr>
</table>
</div>
</asp:Panel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
if i click the btnAdd the value inside category textbox should go to database and popup the window .... but in my project the btnADD button's click event is not firing and modalpopup is working.... please give me a solution..
I've had the same problem, for some reason when you set a button as the TargetControlID of the modal popup it disables the Click event.
The way I overcame this issue was by placing an invisible/dummy Label control on the page and setting the TargetControlID property of the modal to this Label.Then in your btnAdd Click event get all the necessary values from the db and simply call the ModalPopupExtender1.Show() to display the modal:
ASPX:
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="AddClick" />
<asp:Label ID="dummyLabel" runat="server" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" PopupControlID="Panel1" TargetControlID="dummyLabel"
BackgroundCssClass="modalBackground" runat="server">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" align="center" CssClass="modalPopup" runat="server">
<div class="body-reg-left">
<table>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Brand Name" CssClass="lbF"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbrdName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="BtnBrdName" runat="server" Text="Add" Width="70px" OnClick="Add" />
<asp:Button ID="btncancel" runat="server" Text="Cancel" OnClick="Cancel" />
</td>
</tr>
</table>
</div>
</asp:Panel>
</div> </div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</form>
Code behind:
protected void Add(object sender, EventArgs e)
{
//Add logic
}
protected void Cancel(object sender, EventArgs e)
{
//Cancel logic
}
protected void AddClick(object sender, EventArgs e)
{
txtbrdName.Text = "Some category"; //Populate the value as required
ModalPopupExtender1.Show();
}

Two ModalPopupExtenders used in the same way, only one works

Within a gridview, I have an "Email" button and a "Delete" button that opens up a Modal popup window using the modalpopupextender. The problem is that the Email window opens when the button is clicked, but the Delete window does not open when its button is clicked. I am using both modalpopupextenders in the same way.
<asp:ButtonField ButtonType="Button" CommandName="Email" Text="Email" />
<asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete" />
<%-- Email modal--%>
<asp:Panel ID="pnlPopupEmail" runat="server" Width="500px" Style="display: none">
<asp:UpdatePanel ID="updPnlEmail" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btnShowEmail" runat="server" Style="display: none" />
<ajaxToolkit:ModalPopupExtender ID="mdlPopupEmail" runat="server" TargetControlID="btnShowEmail"
PopupControlID="pnlPopupEmail" CancelControlID="btnCancel" BackgroundCssClass="modalBackground" />
<div class="EmailPopup">
<table>
<tr>
<td>
To:
</td>
<td>
<asp:TextBox ID="EmailTo" runat="server" Width="350"></asp:TextBox>
</td>
</tr>
<tr>
<td>
From:
</td>
<td>
<asp:TextBox ID="EmailFrom" runat="server" Width="350"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Subject:
</td>
<td>
<asp:TextBox ID="Subject" runat="server" Width="350"></asp:TextBox>
</td>
</tr>
<tr>
<td></td>
<td> <asp:TextBox ID="EmailMessageBox" Width="350" Height="150" runat="server" TextMode="MultiLine" Wrap="true"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:LinkButton ID="SendBtn" runat="server" OnClick="SendBtn_Clicked" Text="Send" />
<asp:LinkButton ID="btnCancel" runat="server" Text="Cancel" CausesValidation="false" />
</td>
<td>
<asp:Label ID="theID" runat="server" Visible="false"></asp:Label>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<%-- -----end email modal--%>
<%-- Start Delete Confirmation Modal --%>
<asp:Panel ID="DelConfirmPanel" runat="server" Width="500px" Style="display: none">
<asp:UpdatePanel ID="DelConfirmUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID ="TESTLabel" runat="server" Text="Are you sure?" ></asp:Label>
<asp:Button ID="DelModalButton" runat="server" Style="display: none" />
<ajaxToolkit:ModalPopupExtender ID="modalPopUpDelConfirm" runat="server" TargetControlID="DelModalButton"
PopupControlID="DelConfirmPanel" CancelControlID="DeleteCancel" BackgroundCssClass="modalBackground" />
<div class="DeletePopup">
<asp:LinkButton ID="DelConfirmedButton" runat="server" OnClick="DeleteConfirmation_Clicked"
Text="Delete" />
<asp:LinkButton ID="DeleteCancel" runat="server" Text="Cancel" CausesValidation="false" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<%-- End Delete Confirmation Modal --%>
</div>
Then in the codebehind I have a method that checks the command name and updates the updatepanel and shows the modalpopupextender.
protected void btn_Clicked(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Email")
{
// a bunch of stuff that I am leaving out but is just changing fields in the
//table withing the modal popup
updPnlEmail.Update();
mdlPopupEmail.show();
}
if (e.CommandName.Equals("Delete"))
{
int index = Convert.ToInt32(e.CommandArgument);
String id = gvReservations.DataKeys[index].Value.ToString(); // get id
try
{
DelConfirmUpdatePanel.Update();
modalPopUpDelConfirm.Show();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
Any ideas why one works and not the other? Is there a good way to debug this kind of error? Thanks a lot for any help!
Figured it out.
<asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete" />
This is where the problem was. I didn't realize that "Delete" was a reserved command name. So when this button was clicked an exception was being thrown saying that it couldn't delete from the table. Thus, the modal popup was never being shown. I figured it out by opening the javascript console in the chrome tools.
So to fix it, I changed the command name to something else and now everything works as expected.

modal popup extender problem

i use modal popup extender to show my details in another separate window it is a panel contains some controls the problem is ::
when i click on my button which contains::
the Show() method the parent page just frozen and no popup appears at all on the other side i have a grid view when i click on the last button on it the popup appears where the other buttons on the grid view make the same behavior of my first button , i donot know what is the problem my panel visibility = true and no setting in my behind code..i view the source and i find the panel with its contents then why the popup window doesnot appear..i search alot but i donot find a solution to my problem ..
my aspx::
<asp:Panel id="master_editMode" runat="server" >
<div id="masterDiv" style="width:98%" dir="rtl">
<div id="masterControls" align="center">
<table border="0" width="98%">
<tr>
<td align="center" dir="rtl">
<asp:ObjectDataSource ID="ObjDS_AllTasks" runat="server"
SelectMethod="Get_All_Tasks" TypeName="DocumentFlowModuleDTO.TaskDTO">
</asp:ObjectDataSource>
<asp:HiddenField ID="hd_Task_Code" runat="server" />
<table>
<tr>
<td>
<asp:Label ID="Label11" runat="server" Text="Search for Task" Visible="False"></asp:Label>
</td>
<td align="right">
<asp:TextBox ID="txt_Search" runat="server" AutoPostBack="True"
ontextchanged="txt_Search_TextChanged" Width="200px" Visible="False"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
<asp:GridView ID="grd_AllTasks" runat="server" AllowPaging="True"
AutoGenerateColumns="False" CssClass="Alternating" DataKeyNames="task_code"
DataSourceID="ObjDS_AllTasks"
onpageindexchanging="grd_AllTasks_PageIndexChanging"
onrowdatabound="grd_AllTasks_RowDataBound" style="margin-right: 0px">
<RowStyle VerticalAlign="Top" />
HeaderText="ÍÐÝ">
<ItemTemplate>
<asp:ImageButton ID="btn_Delete_Task" runat="server"
CommandArgument="<%# Bind('task_code') %>" Height="33px"
ImageUrl="~/Images/delete.png" oncommand="btn_Delete_Task_Command"
Width="67px" />
<cc1:ConfirmButtonExtender ID="btn_Delete_Task_ConfirmButtonExtender"
runat="server" ConfirmText="åá ÊÑíÏ ÍÐÝ æËíÞÉ ÇáÇÚÊãÇÏ ¿" Enabled="True"
TargetControlID="btn_Delete_Task">
</cc1:ConfirmButtonExtender>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle HorizontalAlign="Right" />
</asp:GridView>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" dir="rtl">
<asp:Label ID="lbl_TaskName" runat="server" Font-Bold="True" Font-Size="13pt"></asp:Label>
</td>
</tr>
<tr>
<td align="center" dir="rtl" style="height: 196px">
<table>
<tr>
<td align="left">
<asp:Label ID="lbl_No_States" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
</td>
<td align="right">
<asp:ImageButton ID="btn_AddStatesToTask" runat="server"
ImageUrl="Images/add.png" onclick="btn_AddStatesToTask_Click" Visible="False" />
<asp:Button ID="Dummy_btn2" runat="server" Text="Button" Style="display:none;" />
<cc1:ModalPopupExtender ID="btn_AddStatesToTask_ModalPopupExtender"
runat="server"
TargetControlID="Dummy_btn2"
BackgroundCssClass="modalBackground"
PopupControlID="pnl_Add_States"
DropShadow="True">
</cc1:ModalPopupExtender>
</td>
</tr>
</table>
<asp:HiddenField ID="hd_StateSerial" runat="server" />
<asp:HiddenField ID="hd_StateRowIndex" runat="server" />
<asp:GridView ID="grd_States" runat="server" AllowPaging="True" DataKeyNames="state_serial"
onpageindexchanging="grd_States_PageIndexChanging" Visible="False"
CssClass="Alternating" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="state_name" HeaderText="ÇáãÑÍáÉ"
ShowHeader="False" />
<asp:BoundField DataField="state_order" HeaderText="ÊÑÊíÈ ÇáãÑÍáÉ"
ShowHeader="False" />
<asp:TemplateField HeaderText="Power" ShowHeader="False">
<EditItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="chb_StatePower" runat="server"
Checked='<%# Convert.ToBoolean(Eval("power_flag")) %>' Enabled="False" />
</ItemTemplate>
<ItemStyle Width="40px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="New" ShowHeader="False">
<EditItemTemplate>
<asp:CheckBox ID="CheckBox3" runat="server" />
<asp:Button ID="Dummy_btn4" runat="server" Text="Button" Style="display:none;" />
<cc1:ModalPopupExtender ID="btn_TaskState_Edit_ModalPopupExtender" runat="server"
TargetControlID="Dummy_btn4"
BackgroundCssClass="modalBackground"
PopupControlID="pnl_Add_States"
DropShadow="True">
</cc1:ModalPopupExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ÍÐÝ" ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="btn_TaskState_Delete" runat="server"
CommandArgument="<%# Bind('state_serial') %>" Height="26px"
ImageUrl="~/Images/delete.png" oncommand="btn_TaskState_Delete_Command"
Width="47px" />
<cc1:ConfirmButtonExtender ID="btn_TaskState_Delete_ConfirmButtonExtender"
runat="server" ConfirmText="åá ÊÑíÏ ÍÐÝ ÇáãÑÍáÉ ¿" Enabled="True"
TargetControlID="btn_TaskState_Delete">
</cc1:ConfirmButtonExtender>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<asp:ObjectDataSource ID="ObjectDataSource_States" runat="server"
SelectMethod="Select_TaskStates" TypeName="DocumentFlowModule.DTO.TaskStateDTO">
<SelectParameters>
<asp:Parameter Name="task_code" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnl_Add_Task" runat="server" CssClass="modalPopup"><%-- Style="display:none;"--%>
<div id="div3" style="width: 95%">
<div id="div4" align="center">
<table>
<tr>
<td>
<asp:UpdatePanel ID="UpPnl1" runat="server">
<ContentTemplate>
<table dir="rtl" style="text-align: right">
<tr bgcolor="#f1ece2">
<th align="right" height="35" valign="middle" colspan="3">
<asp:Label ID="lbl_New_Task" runat="server" Font-Bold="False" Font-Size="14pt"
Text="ÅÖÇÝÉ æËíÞÉ ÇÚÊãÇÏ" Visible="False"></asp:Label>
<asp:Label ID="lbl_Edit_Task" runat="server" Font-Bold="False" Font-Size="14pt"
Text="ÊÚÏíá æËíÞÉ ÇÚÊãÇÏ" Visible="False"></asp:Label>
</th>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label1" runat="server" Text="Task Name"></asp:Label>
</td>
<td style="width: 140px">
<asp:TextBox ID="txt_TaskName" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_TaskName" ErrorMessage="*" ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label10" runat="server" Text="DataBase Name"></asp:Label>
</td>
<td style="width: 140px">
<asp:DropDownList ID="ddl_DataBases" runat="server" AutoPostBack="True"
ondatabound="ddl_DataBases_DataBound"
onselectedindexchanged="ddl_DataBases_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="ddl_DataBases" ErrorMessage="*" InitialValue="--Select--"
ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label2" runat="server" Text="Table Name"></asp:Label>
</td>
<td style="width: 140px">
<asp:DropDownList ID="ddl_Tables" runat="server" AutoPostBack="True"
ondatabound="ddl_Tables_DataBound"
onselectedindexchanged="ddl_Tables_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="ddl_Tables" ErrorMessage="*" InitialValue="--Select--"
ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label17" runat="server" Text="Table Key"></asp:Label>
</td>
<td style="width: 140px">
<asp:Label ID="lbl_Key" runat="server"></asp:Label>
<asp:CheckBoxList ID="cbl_Columns" runat="server">
</asp:CheckBoxList>
</td>
<td>
<asp:Label ID="lbl_Select_Key" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label18" runat="server" Text="Current Record State"></asp:Label>
</td>
<td style="width: 140px">
<asp:DropDownList ID="ddl_Columns" runat="server" AutoPostBack="True"
ondatabound="ddl_Columns_DataBound">
</asp:DropDownList>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="ddl_Columns" ErrorMessage="*" InitialValue="--Select--"
ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label5" runat="server" Text="Form View "></asp:Label>
</td>
<td style="width: 140px">
<asp:TextBox ID="txt_F_View" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="txt_F_View" ErrorMessage="*" InitialValue="--Select--"
ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label6" runat="server" Text="Form New"></asp:Label>
</td>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td dir="rtl" align="center">
<asp:ImageButton ID="btn_OK" runat="server" ImageUrl="~/Images/add.png"
onclick="btn_OK_Click" ValidationGroup="G1" Visible="False" />
<asp:ImageButton ID="btn_Edit" runat="server" ImageUrl="~/Images/edit.png"
onclick="btn_Edit_Click" ValidationGroup="G1" Visible="False" />
<asp:ImageButton ID="btn_Cancel_Task" runat="server" CausesValidation="False"
Height="36px" ImageUrl="~/Images/cancel.png" onclick="btn_Cancel_Task_Click" />
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>
the btn_add _task does not make my popup appear just freeze the parent page
my .cs
protected void btn_Add_Task_Click(object sender, EventArgs e)
{
//AjaxControlToolkit.ModalPopupExtender modal1 = (AjaxControlToolkit.ModalPopupExtender) table1.FindControl("btn_Add_Task_ModalPopupExtender");
//modal1.Show();
grd_States.Visible = false;
lbl_No_States.Text = "";
btn_AddStatesToTask.Visible = false;
lbl_TaskName.Text = "";
//master_editMode.Visible = true;
//pnl_Add_Task.Visible = true;
btn_OK.Visible = true;
btn_Edit.Visible = false;
lbl_New_Task.Visible = true;
lbl_Edit_Task.Visible = false;
txt_TaskName.Text = "";
ddl_DataBases.ClearSelection();
ddl_Tables.Items.Clear();
ddl_Columns.Items.Clear();
cbl_Columns.Items.Clear();
txt_F_New.Text = "";
txt_F_View.Text = "";
txt_Params.Text = "";
txt_SP_Name.Text = "";
btn_Add_Task_ModalPopupExtender.Show();
}
thanks in advance
EDITED::
<table align="center" dir="rtl">
<tr>
<td >
<asp:Button ID="Dummy_btn" runat="server" Text="Button" Style="display:none;" />
<asp:Button ID="btn_Add_Task" runat="server" Text="ÅÖÇÝÉ æËíÞÉ ÇÚÊãÇÏ ÌÏíÏÉ"
onclick="btn_Add_Task_Click" Font-Bold="True" Font-Size="12pt"
ForeColor="#0066FF" />
<cc1:ModalPopupExtender ID="btn_Add_Task_ModalPopupExtender" runat="server"
TargetControlID="Dummy_btn"
PopupControlID="pnl_Add_Task"
BackgroundCssClass="modalBackground"
DropShadow="True" >
</cc1:ModalPopupExtender>
</td>
</tr>
</table>`
If you want your modal popup to be displayed when the user clicks on the btn_Add_Task button, you should set that button as the TargetControlID of the extender:
<cc1:ModalPopupExtender ID="btn_Add_Task_ModalPopupExtender" runat="server"
TargetControlID="btn_Add_Task" PopupControlID="pnl_Add_Task"
BackgroundCssClass="modalBackground" DropShadow="True" />
In your current code, the modal popup is triggered by a button named Dummy_btn, which I can't find in your markup, but which probably isn't what you want.
We had many issues with ajax popup. you might want to try the approach we have been using for past one month or so with out any issues. This approach creates a popup with out need of ajax / jquery / javascript /css/ update panel .
here:
A modal popup with out using ajax, update panel, jquery or javascript- surprisingly this seems to work

Categories

Resources