I have a GridView which charge user data, selecting one lifts the panel through a ModalPopupExtender, this panel has UpdatePanel nested as you can see in the code, pressing the save button closes the Popup, can not find the error. help me with this problem.
Removing the UpdatePanel not let the FileUpload upload the file but no longer the Popup is closed, but I need to upload the file and that the Popup is not closed.
<asp:Panel ID="pDatos" runat="server" BackColor="#E0E0E0">
<table>
<tr>
<td>
<asp:GridView runat="server" ID="gvResultado" AutoGenerateColumns="false"
OnRowCommand="gvResultado_OnRowCommand" DataKeyNames="Id, Estado" >
<Columns>
<asp:ButtonField DataTextField="Id" ItemStyle-ForeColor="Black"
ControlStyle-CssClass="hover" CommandName="gvResultado"
HeaderText="Verificar"/>
<asp:BoundField DataField="Nombre" HeaderText="Nombre" ItemStyle-Width="320px" />
<asp:BoundField DataField="Observaciones" HeaderText="Observaciones" ItemStyle-Width="360px" />
<asp:BoundField DataField="Fecha" HeaderText="Fecha" />
<asp:BoundField DataField="Estado" HeaderText="Estado" ItemStyle-Width="120px" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</asp:Panel>
<asp:HiddenField ID="hfPopup" runat="server" />
<ajax:ModalPopupExtender ID="mpePopup" runat="server" PopupControlID="pPopup"
TargetControlID="hfPopup" BackgroundCssClass="backgroundColor">
</ajax:ModalPopupExtender>
<asp:Panel ID="pPopup" runat="server" BackColor="#CFCFCF" Style="display: none" >
<asp:UpdatePanel ID="upPopup" runat="server">
<ContentTemplate>
<table style="width:740px;" align="center">
<tr>
<td align="center" colspan="2">
<asp:GridView runat="server" ID="gvHistorial" AutoGenerateColumns="false"
OnRowCommand="gvHistorial_RowCommand" DataKeyNames="Descargar" >
<Columns>
<asp:BoundField DataField="Legajo" HeaderText="Legajo" ItemStyle-Width="100"/>
<asp:BoundField DataField="Observaciones" HeaderText="Observaciones" ItemStyle-Width="550" />
<asp:BoundField DataField="Fecha" HeaderText="Fecha" ItemStyle-Width="150"/>
<asp:ButtonField DataTextField="Descargar" HeaderText="Descargar" CommandName="gvHistorial_Descargar" />
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td><!-- --></td>
<td >
<asp:UpdatePanel ID="upArchivo" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:FileUpload ID="luSeleccione" runat="server" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="bGuardar" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td><!-- --></td>
<td align="left">
<asp:Button runat="server" ID="btnGuardar" OnClick="btnGuardar_Click"
Text="Guardar" CssClass="Button hover" />
<asp:Button runat="server" ID="btnSalir" OnClick="btnSalir_Click"
Text="Salir" CssClass="Button hover" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
Related
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
<Services>
<asp:ServiceReference Path="Machine.asmx" />
</asp:ScriptManager>
<div align="center" style="width:auto" >
<asp:UpdatePanel ID="up1" runat="server" Visible="true" UpdateMode="Conditional">
<ContentTemplate>
<table class="nav-justified" border="1" id="table1">
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Select Search Criteria"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlSearchCriteria" runat="server" AutoPostBack="true" EnableViewState="true" OnSelectedIndexChanged="ddlSearchCriteria_SelectedIndexChanged" Height="30px" Width="200px">
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">All</asp:ListItem>
<asp:ListItem Value="2">Data Center</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr id="trDC" runat="server" visible="false"> <td>
<asp:Label ID="lblRegion" runat="server" Text="Select DataCenter"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlDC" runat="server" AutoPostBack="false" EnableViewState="true" OnSelectedIndexChanged="ddlDC_SelectedIndexChanged" Height="30px" Width="200px">
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">a </asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr id="tr1" runat="server" visible="false" >
<td>
<asp:Label ID="lblOrder" runat="server" Text="Order For SOEID"></asp:Label>
</td>
<td >
<asp:TextBox ID="txtOrderFor" runat="server" Height="20px" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="up1" DisplayAfter="0" DynamicLayout="false">
<ProgressTemplate>
<div style="position:absolute; left:45%;">
<div style="position:relative; left:45%;">
<table border="0" align="center">
<tr>
<td>
<img alt=""src="img/loading.gif" height="50px" width="50px" />
</td>
</tr>
</table>
<center>
Please wait...
</center>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
<asp:UpdatePanel ID="up2" runat="server">
<ContentTemplate>
<asp:Label ID="lblRows" runat="server" Font-Size="Large" Visible="false" ></asp:Label>
<asp:GridView ID="gvDetails" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="3" CssClass="bootstrap dataTables_wrapper" DataKeyNames="Order_Item_Id” EnableViewState="false" HeaderStyle-HorizontalAlign="Left" OnPageIndexChanging="gvDetails_PageIndexChanging" OnRowCommand="gvDetails_RowCommand" OnRowDataBound="gvDetails_RowDataBound" PageSize="15" ShowHeaderWhenEmpty="true" Visible="true" Width="100%">
<Columns>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkBox1" runat="server" AutoPostBack="true" OnCheckedChanged="Check_Clicked"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Order_Item_Id" HeaderStyle-HorizontalAlign="Left" HeaderText="Order Id" />
</Columns>
</asp:GridView>
</div>
<asp:Button ID="Button4" runat="server" Font-Bold="True" Font-Size="XX-Large" OnClick="Button4_Click" Text="Export To Excel" visible="false" />
<asp:Button ID="Button3" runat="server" Font-Bold="True" Font-Size="XX-Large" OnClick="Button3_Click" Text="Submit" Visible="false" />
<asp:Button ID="Button1" runat="server" Font-Bold="True" Font-Size="XX-Large" OnClick="Button1_Click" Text="Cancel" Visible="false" />
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Button4" />
<asp:PostBackTrigger ControlID="Button3" />
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
I have two update panel and 1 update progress on my aspx page. My first update panel contains two dropdown, on change of first dropdown, second populates and also there is a submit button in the update panel.
When I use selectedindexchange of dropdown, Autopostback occurs, update progress works but I don't want it to work on that event. It should work only on the submit click.
Second update panel contains the data to be shown on click of submit button.
Also,My update progress is not in any of the update panel, it is in a div between both the update panel.
I have a gridview in which one of the column contains radio button. which i have placed inside item template. I want to trigger async callback to a panel in which i have a grid. this complete page is a user control.
When i am unable to add the trigger
<asp:GridView ID="grdBalStatus" runat="server" AutoGenerateColumns="false" Width="100%">
<HeaderStyle CssClass="dlresultheader" />
<RowStyle CssClass="griditems" />
<Columns>
<asp:BoundField DataField="TerminalId" HeaderStyle-Width="35%" />
<asp:BoundField DataField="Description"></asp:BoundField>
<asp:TemplateField HeaderStyle-Width="65%" HeaderText="Auto/Full Balancing Status">
<HeaderTemplate>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" style="width: 32%">
<%--<asp:Label ID="lblSelAll" runat="server" CssClass="autoresultheader" Text="All:"></asp:Label>--%>
</td>
<td align="left" style="width: 60%">
<asp:RadioButton ID="rdAllAuto" runat="server" CssClass="autoresultheader" GroupName="AutoorFull1"
Text="Auto" ToolTip="Select auto balancing for all Self-Checkouts" />
<asp:RadioButton ID="rdAllFull" runat="server" CssClass="autoresultheader" GroupName="AutoorFull1"
Text="Full" ToolTip="Select full balancing for all Self-Checkouts" />
</td>
<td style="width: 8%">
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" style="width: 32%">
<asp:Label runat="server" ID="TermId" Text='<%# Eval("TerminalId") %>' CssClass="hide"></asp:Label>
</td>
<td align="left" style="width: 60%">
<asp:RadioButton ID="rdAuto" runat="server" CssClass="fullgriditems" GroupName="AutoorFull"
Text="Auto" />
<asp:RadioButton ID="rdFull" runat="server" CssClass="fullgriditems" GroupName="AutoorFull"
AutoPostBack="true" OnCheckedChanged="rdFull_CheckedChanged" Text="Full" />
</td>
<td style="width: 8%">
<%--<asp:Label runat="server" ID="Version" Text='<%# Eval("TerminalVersion") %>' CssClass="hide"></asp:Label> --%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="TerminalVersion"></asp:BoundField>
</Columns>
</asp:GridView>
Code in the update panel
<asp:UpdatePanel ID="upFullBalTerm" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rdFull" EventName="CheckedChanged" />
</Triggers>
<ContentTemplate>
<table width="100%">
<tr id="trFullBalTl" class="hide" runat="server">
<td style="padding-top: 5px;" id="tdFullBalTerminal">
<asp:GridView runat="server" ID="grdFullBalTerminal" AutoGenerateColumns="false" Width="80%" BorderStyle="None" ShowHeader="true">
<HeaderStyle CssClass="dlresultheader" Width="15%" Height="30" />
<RowStyle CssClass="griditems" VerticalAlign="Bottom" />
<EmptyDataTemplate></EmptyDataTemplate>
<Columns>
<asp:TemplateField HeaderText="Terminal Id">
<HeaderStyle Width="12%" BorderStyle="None" />
<ItemStyle BorderStyle="none" CssClass="dlresultheader" />
<ItemTemplate>
<asp:Label runat="server" ID="lblFullBalTlId" Text='<%# Eval("terminal") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Please suggest how to write the trigger.
I used a hidden button which is the trigger for the update panel. On click event of the radio button i called button click event using javascript.
I shown Modal popup (Modal2) on this Modal popup I have grid contain link button.
on click event of link button i have to show another modal popup having grid.
My First Modal popup Showing
<asp:Button ID="btnScholershipApp" runat="server" Text="Button" SkinID="SelectButton" />
<Ajax:ModalPopupExtender ID="Modal2" runat="server" PopupControlID="table2" CancelControlID="img1"
TargetControlID="btnScholershipApp" OnCancelScript="javascript:__doPostBack('clearfields2')">
</Ajax:ModalPopupExtender>
First Modal popup
<table id="table2" runat="server" border="0" cellpadding="0" cellspacing="0" height="100%"
style="border-collapse: collapse; height: auto; margin: 0px; padding: 0px; display: none;"
width="1000" class="popupheading">
<tr>
<td>
<div style="width: 1000px; height: auto;">
<div style="width: 1000px; height: 40px; background-image: url('../../../PopU/top.png');
background-repeat: no-repeat;">
<img id="img1" runat="server" height="40" src="~/Images/close1.png" style="float: right;"
width="40" />
</div>
<div style="width: 980px; height: auto; min-height: 100px; background-image: url('../../../PopU/center_bg.png');
background-repeat: repeat-y; padding: 0 10px 0 10px;">
<asp:Panel ID="modal_panel2" runat="server" Height="550" Width="980">
<table cellpadding="7px" cellspacing="7px" width="100%">
<tr>
<td>
<fieldset>
<legend class="legend">Search </legend>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Student Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSAStudentName" runat="server"></asp:TextBox>
</td>
<td>
<asp:Label ID="Label6" runat="server" Text="Student ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSAStudentID" runat="server"></asp:TextBox>
</td>
<td>
<asp:Label ID="Label4" runat="server" Text="Scholership Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSAScholershipName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="University PRN"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSAScholershipPRN" runat="server"></asp:TextBox>
</td>
<td>
<asp:Label ID="Label12" runat="server" Text="Date Of Birth"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSADateOfBirth" runat="server"></asp:TextBox>
<ajaxtoolkit:CalendarExtender ID="CalendarExtender1" runat="server" Enabled="True"
TargetControlID="txtSADateOfBirth">
</ajaxtoolkit:CalendarExtender>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
<table width="100%">
<tr style="background-color: #F6F0DB;">
<td align="center" colspan="4">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:HiddenField ID="hfScholershipName" runat="server" />
<asp:HiddenField ID="hfScholershipPRN" runat="server" />
<asp:HiddenField ID="hfScholershipApplicationID" runat="server" />
<asp:HiddenField ID="hfScholershipDocumentID" runat="server" />
<asp:GridView ID="grdScholershipApp" runat="server" AutoGenerateColumns="false" AllowPaging="True"
OnPageIndexChanging="grdScholershipApp_PageIndexChanging" PageSize="10" Width="970px">
<Columns>
<asp:BoundField DataField="StudentId" HeaderText="Student ID" />
<asp:BoundField DataField="FullName" HeaderText="Student Name">
<ItemStyle HorizontalAlign="Center" Width="250" />
</asp:BoundField>
<asp:BoundField DataField="ScholershipPRN" HeaderText="University PRN" />
<asp:BoundField DataField="DateOfBirth" HeaderText="Date of birth" />
<asp:BoundField DataField="ScholershipName" HeaderText="Scholership Name" />
<asp:TemplateField HeaderText="Options">
<ItemTemplate>
<asp:UpdatePanel ID="pnlup2" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="btnEditStudentApplication" />
</Triggers>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnStudentDocumentIDShow" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:ImageButton ID="btnEditStudentApplication" runat="server" CommandArgument='<%#Eval("PanomtechServiceID")+";"+Eval("StudentID")+";"+Eval("ScholershipPRN")+";"+Eval("ScholershipName")%>'
SkinID="Select" OnClick="btnEditStudentApplication_Click" />
<%--<asp:Panel ID="Panel12" runat="server" >
<asp:UpdatePanel ID="UpdatePanel4" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="hfbtnStudentDocumentIDShow" runat="server" Style="display: none;" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="hfbtnStudentDocumentIDShow" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>--%>
<asp:LinkButton ID="btnStudentDocumentIDShow" runat="server" Text="Documents" CommandArgument='<%#Eval("PanomtechServiceID")+";"+Eval("StudentID")+";"+Eval("StudentDocumentID")%>'
OkControlID="hfbtnStudentDocumentIDShow" />
<%-- OnClick="hfbtnStudentDocumentIDShow_Click" --%>
<%--<Ajax:ModalPopupExtender ID="modal4" runat="server" PopupControlID="table4" CancelControlID="img3"
TargetControlID="btnStudentDocumentIDShow" OnCancelScript="javascript:__doPostBack('clearfields4')">
</Ajax:ModalPopupExtender>--%>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
no data.......
</EmptyDataTemplate>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Panel>
</div>
<div style="width: 1000px; height: 40px; background-image: url('../../../PopU/bottom.png');
background-repeat: no-repeat;">
</div>
</div>
</td>
</tr>
</table>
<Ajax:AnimationExtender ID="AnimationExtender2" runat="server" TargetControlID="btnScholershipApp">
<Animations>
<OnClick>
<Parallel AnimationTarget="table2"
Duration=".9" Fps="50">
<FadeIn Duration=".9"/>
</Parallel>
</OnClick>
</Animations>
</Ajax:AnimationExtender>
LinkButton Event
protected void hfbtnStudentDocumentIDShow_Click(object sender, EventArgs e)
{
modal4.Show();
}
Second Modal popup
<table id="table4" runat="server" border="0" cellpadding="0" cellspacing="0" height="100%"
style="border-collapse: collapse; height: auto; margin: 0px; padding: 0px;" width="1000"
class="popupheading">
<tr>
<td>
<div style="width: 1000px; height: auto;">
<div style="width: 1000px; height: 40px; background-image: url('../../../PopU/top.png');
background-repeat: no-repeat;">
<img id="img4" runat="server" height="40" src="~/Images/close1.png" style="float: right;"
width="40" />
</div>
<div style="width: 980px; height: auto; min-height: 100px; background-image: url('../../../PopU/center_bg.png');
background-repeat: repeat-y; padding: 0 10px 0 10px;">
<asp:Panel ID="modal_panel4" runat="server" Height="550" Width="980">
<table width="100%">
<tr style="background-color: #F6F0DB;">
<td align="center" colspan="4">
<asp:UpdatePanel ID="uppanel" runat="server">
<ContentTemplate>
<asp:GridView ID="grdStudentDocuments" runat="server" AutoGenerateColumns="false"
AllowPaging="True" OnPageIndexChanging="grdStudentDocuments_PageIndexChanging"
PageSize="10" Width="970px">
<Columns>
<asp:BoundField DataField="StudentId" HeaderText="Student ID" />
<asp:BoundField DataField="FullName" HeaderText="Student Name">
<ItemStyle HorizontalAlign="Center" Width="250" />
</asp:BoundField>
<asp:BoundField DataField="DocumentName" HeaderText="Document Name" />
<asp:BoundField DataField="ScholershipPRN" HeaderText="University PRN" />
<asp:BoundField DataField="ScholershipName" HeaderText="Scholership Name" />
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:UpdatePanel ID="pnlup3" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="btnEditSStudentDocuments" />
</Triggers>
<ContentTemplate>
<asp:ImageButton ID="btnEditSStudentDocuments" runat="server" CommandArgument='<%#Eval("StudentDocumentID")%>'
SkinID="Select" OnClick="btnEditSStudentDocuments_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
no data.......
</EmptyDataTemplate>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Panel>
</div>
<div style="width: 1000px; height: 40px; background-image: url('../../../PopU/bottom.png');
background-repeat: no-repeat;">
</div>
</div>
</td>
</tr>
</table>
<asp:Button ID="hfbtnStudentDocumentIDShow" runat="server" OnClick="hfbtnStudentDocumentIDShow_Click"
Style="display: none;" />
<Ajax:ModalPopupExtender ID="modal4" runat="server" PopupControlID="table4" CancelControlID="img3"
TargetControlID="hfbtnStudentDocumentIDShow" OnCancelScript="javascript:__doPostBack('clearfields4')">
</Ajax:ModalPopupExtender>
<Ajax:AnimationExtender ID="AnimationExtender4" runat="server" TargetControlID="hfbtnStudentDocumentIDShow">
<Animations>
<OnClick>
<Parallel AnimationTarget="table4"
Duration=".9" Fps="50">
<FadeIn Duration=".9"/>
</Parallel>
</OnClick>
</Animations>
</Ajax:AnimationExtender>
Problem
When I click on link button it does not display any thing Please help me
Try this, i read somewhere on a blog that when i was stuck in this issue that using ModaloPopup Extender in Update Panel causes issue if we do not use them in the right order, the code i am posting works fine for me, in my case also i am using ModalPopupExtender within update panel try this order of ModalPopupExtender with Update Panel, it will surely work:
<div class="popup">
<asp:Button ID="Button7" runat="server" Text="Button" Style="display: none;" />
<asp:Button ID="Button8" runat="server" Style="display: none;" />
<asp:ModalPopupExtender ID="ModalPopupUploadFiles" BehaviorID="ModalPopupUploadFiles" runat="server" CancelControlID="ImageButton1"
TargetControlID="Button7" PopupControlID="PanelUploadFiles" PopupDragHandleControlID="PopupHeader"
Drag="true" BackgroundCssClass="Overlay">
<Animations>
<OnShown>
<FadeIn Duration=".50" Fps="10" />
</OnShown>
</Animations>
</asp:ModalPopupExtender>
<!--unique css-->
<asp:Panel ID="PanelUploadFiles" runat="server" Style="display: none; overflow:scroll; width:750px; height:400px;" class="PopUpPanel">
<asp:Panel ID="panel1" runat="server" class="closeButton">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/cross.png"/>
</asp:Panel>
<asp:UpdatePanel ID="updtPanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="True">
<ContentTemplate>
<br />
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
<tr>
<td align="left" valign="top">
<table id="delgateContainer" width="90" border="0" align="left" cellpadding="0" cellspacing="3">
<tr align="center" valign="middle">
<td><asp:ImageButton ID="btnAddFiles" ClientIDMode="Static" ImageUrl="~/images/add.gif" runat="server"/></td>
<td><asp:ImageButton ID="btnStartUpload" ClientIDMode="Static" ImageUrl="~/images/start.gif" runat="server" OnClick="btnStartUpload_Click" /></td>
<td><asp:ImageButton ID="btnCancelUpload" ImageUrl="~/images/cancel.gif" runat="server" OnClick="btnCancelUpload_Click" /></td>
<td><asp:ImageButton ID="btnDeleteAllUploads" ClientIDMode="Static" ImageUrl="~/images/delete2.gif" runat="server" OnClick="btnDeleteAllUploads_Click" /></td>
<td align="left"><asp:CheckBox ID="chckBoxDeleteAll" ClientIDMode="Static" runat="server" /></td>
<td> </td>
</tr>
<tr align="center" valign="middle">
<td colspan="6"> </td>
</tr>
</table>
<p class="gr"><strong></strong></p><p> </p></td>
</tr>
<tr>
<td height="1" colspan="2" class="bgbl"></td>
</tr>
</table></td>
</tr>
<asp:GridView ID="gvUploadFiles" ClientIDMode="Static" onRowCommand="gvUploadFiles_Clicked" DataKeyNames="FileID,FileName,FileSize,FilePath,Status" AllowPaging="false" runat="server"
PagerStyle-HorizontalAlign="Center" AutoGenerateColumns="false" Width="90%"
CellPadding="0" BorderWidth="0" AlternatingRowStyle-BorderColor="LightGray" AlternatingRowStyle-BorderWidth="1" GridLines="None" ShowHeader="true" AlternatingRowStyle-BackColor="#f9f9f9" >
<Columns>
<asp:ImageField DataImageUrlField="ThumbanilPath" HeaderText="Thumbnail" ItemStyle-CssClass="alignmentCenter" ControlStyle-Width="100px" ControlStyle-Height="100px" runat="server"></asp:ImageField>
<asp:BoundField DataField="FileName" ItemStyle-CssClass="alignmentCenter" HeaderText="File Name" />
<asp:BoundField DataField="FileSize" ItemStyle-CssClass="alignmentCenter" HeaderText="File Size" />
<asp:TemplateField>
<ItemTemplate>
<asp:HiddenField ID="filePaths" Value="FilePath" runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton CommandName="doingUpload" ItemStyle-CssClass="alignmentRight" class="btnStart" CommandArgument='<%#Container.DisplayIndex%>' ID="imgBtnStart" ImageUrl="~/images/start2.gif" runat="server" /></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgBtnCancel" ItemStyle-CssClass="alignmentLeft" CommandName="cancelUploading" CommandArgument='<%#Container.DisplayIndex%>' ImageUrl="~/images/cancel2.gif" runat="server" /></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton CommandName="deleteFile" ItemStyle-CssClass="alignmentRight" Visible="false" id="imgBtnDelete" CommandArgument='<%#Container.DisplayIndex%>' runat="server" ImageUrl="~/images/delete2.gif"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox Visible="false" ID="chckBoxDelete" ItemStyle-CssClass="alignmentLeft" class="deleteChkBox" ClientIDMode="Static" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:HiddenField ID="uploadStatus" Value="Status" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FileID" Visible="false" />
</Columns>
</asp:GridView>
<div id="UploadControl1">
<asp:Button ID="Button17" runat="server" Style="display: none;" />
<asp:ModalPopupExtender ID="ModalPopupUploadControl" BehaviorID="ModalPopupUploadControl" runat="server" CancelControlID="ImageButton4"
TargetControlID="btnAddFiles" PopupControlID="Panel5" PopupDragHandleControlID="PopupHeader"
Drag="true" BackgroundCssClass="Overlay">
<Animations>
<OnShown>
<FadeIn Duration=".50" Fps="10" />
</OnShown>
</Animations>
</asp:ModalPopupExtender>
<asp:Panel ID="Panel5" runat="server" class="PopUpPanel"
style="display: none;overflow:hidden; height:100px; width:300px;"><!---unique css-->
<asp:Panel ID="panel7" runat="server" class="closeButton">
<asp:ImageButton ID="ImageButton4" runat="server" ImageUrl="~/images/cross.png"
/>
</asp:Panel>
<div id="uploadControl" class="all">
<div></div>
<asp:FileUpload ID="uploadingFiles" ClientIDMode="Static" runat="server" class="all" style="display:none;" /><br /><br />
<asp:ImageButton ID="imgBtnAddFile" ClientIDMode="Static" runat="server" ImageUrl="~/images/addToGrid.jpg" OnClick="btnAddToList_Click" style="Display:none;" class="all"/>
</div>
<div>
</div>
</asp:Panel>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="imgBtnAddFile" />
<asp:AsyncPostBackTrigger ControlID="gvUploadFiles" EventName="RowCommand" />
</Triggers>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gvUploadFiles" EventName="RowCommand" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="testing" DisplayAfter="0" AssociatedUpdatePanelID="updtPanel" runat="server">
<ProgressTemplate>
<div style=" left:0px; top:0px; position:fixed; width:100%; height:100%;
background-color:White; filter:alpha(opacity=90);opacity:0.9;">
<asp:Image ID="Image2" style="margin-left:500px; margin-top:300px;" ImageUrl="~/images/ajax-loader.gif" runat="server" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<tr>
<td align="right"><img src="../images/m7.gif" width="115" height="26" /></td>
</tr>
</table>
</asp:Panel>
</div>
I have a panel that i have extended with collapsible extender. It is working perfectly until i try to collapse it by code.
The collapsible panel is shown inside a modal popup where user searches for some data, that is
shown in a grid , In every row of grid there is a select button that fires the row command event of the grid on which i am trying to close the panel.
Markup:
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnAdd"
PopupControlID="pnlpopup" CancelControlID="Cancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="320px" Width="530px"
Style="display: none">
<table width="100%" style="border: Solid 3px #D55500; height: 100%" cellpadding="0"
cellspacing="0">
<tr>
<td>
Bridge ID :
<asp:TextBox ID="txtID" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvID" runat="server" ControlToValidate="txtID" ValidationGroup="vldAddBridge"
ErrorMessage="Please enter ID" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td>
Bridge Name :
<asp:TextBox ID="txtBridgeName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvBridgeName" runat="server" ControlToValidate="txtBridgeName"
ValidationGroup="vldAddBridge" ErrorMessage="Please enter bridge name." ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<td colspan="2" style="text-align: right; margin-left: 40px;">
<asp:Button ID="btnSearchUser" runat="server" OnClick="btnSearchUser_Click" TabIndex="5"
Text="Search" ValidationGroup="vgSearchMember" />
</td>
</tr>
<tr>
<td colspan="5" style="background-color: White" class="style6">
<asp:Label ID="lblSearchResults" runat="server"></asp:Label>
<asp:GridView ID="gvSearchResults" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="White" BorderWidth="1px" CellPadding="4" CssClass="gridviewBorder"
DataKeyNames="EmpId" ForeColor="Black" GridLines="Horizontal" PageSize="5" RowStyle-CssClass="style5"
TabIndex="7" Width="100%" OnPageIndexChanging="gvSearchResults_PageIndexChanging"
OnRowCommand="gvSearchResults_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkSelect" runat="server" Text="Select" CommandName="Select"
CommandArgument='<%# Eval("EmpId") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="EmpId" HeaderText="Employee ID" />
<asp:BoundField DataField="Alias" HeaderText="Username" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
</Columns>
</asp:GridView>
<br />
</td>
</tr>
</table>
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" CollapseControlID="btnOwner"
ExpandControlID="btnOwner" TargetControlID="PnlRegister" Collapsed="true">
</asp:CollapsiblePanelExtender>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br />
<asp:Button ID="btnSaveBridge" runat="server" Text="Save" OnClick="btnSaveBridge_Click"
ValidationGroup="vldAddBridge" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
<span style="display: none">
<input type="button" id="Cancel" /></span>
</td>
</tr>
</table>
</asp:Panel>
Code:
protected void gvSearchResults_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
//some business logic
CollapsiblePanelExtender1.Collapsed = true;
ModalPopupExtender1.Show();
}
}
It is not working the panel is always open ?? Any suggestions.....
You are missing
tr in your design. Please check it
Markup:
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnAdd"
PopupControlID="pnlpopup" CancelControlID="Cancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="320px" Width="530px"
Style="display: none">
<table width="100%" style="border: Solid 3px #D55500; height: 100%" cellpadding="0"
cellspacing="0">
<tr>
<td>
Bridge ID :
<asp:TextBox ID="txtID" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvID" runat="server" ControlToValidate="txtID" ValidationGroup="vldAddBridge"
ErrorMessage="Please enter ID" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td>
Bridge Name :
<asp:TextBox ID="txtBridgeName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvBridgeName" runat="server" ControlToValidate="txtBridgeName"
ValidationGroup="vldAddBridge" ErrorMessage="Please enter bridge name." ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
**<tr> //This is missing**
<td colspan="2" style="text-align: right; margin-left: 40px;">
<asp:Button ID="btnSearchUser" runat="server" OnClick="btnSearchUser_Click" TabIndex="5"
Text="Search" ValidationGroup="vgSearchMember" />
</td>
</tr>
<tr>
<td colspan="5" style="background-color: White" class="style6">
<asp:Label ID="lblSearchResults" runat="server"></asp:Label>
<asp:GridView ID="gvSearchResults" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="White" BorderWidth="1px" CellPadding="4" CssClass="gridviewBorder"
DataKeyNames="EmpId" ForeColor="Black" GridLines="Horizontal" PageSize="5" RowStyle-CssClass="style5"
TabIndex="7" Width="100%" OnPageIndexChanging="gvSearchResults_PageIndexChanging"
OnRowCommand="gvSearchResults_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkSelect" runat="server" Text="Select" CommandName="Select"
CommandArgument='<%# Eval("EmpId") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="EmpId" HeaderText="Employee ID" />
<asp:BoundField DataField="Alias" HeaderText="Username" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
</Columns>
</asp:GridView>
<br />
</td>
</tr>
</table>
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" CollapseControlID="btnOwner"
ExpandControlID="btnOwner" TargetControlID="PnlRegister" Collapsed="true">
</asp:CollapsiblePanelExtender>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br />
<asp:Button ID="btnSaveBridge" runat="server" Text="Save" OnClick="btnSaveBridge_Click"
ValidationGroup="vldAddBridge" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
<span style="display: none">
<input type="button" id="Cancel" /></span>
</td>
</tr>
</table>
</asp:Panel>
Hope it solve your problem
I'm using file upload in my site. I'm uploading word Document(Doc,Docx). Suddenly, it's not working. It is not getting the filename. It is showing empty!!! My Code is as follows:
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<table width="100%" align="center">
<tr>
<td style="height: 21px" align="center">
<span class="lbl"></span>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Button ID="btnResumedload" Text="Download Resume" runat="server" BackColor="Maroon"
ForeColor="White" Font-Bold="true" OnClick="btnResumedload_Click" Height="27px"
Width="195px" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td align="center">
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<asp:Button ID="btnUploadnew" Text="Upload New" runat="server" BackColor="Maroon"
ForeColor="White" Font-Bold="true" OnClick="btnUploadnew_Click" Height="30px"
Width="198px" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td align="center">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:Button ID="btnDel" Height="30px" Width="198px" OnClientClick="return confirm('Are you sure?');"
BackColor="Maroon" ForeColor="White" Font-Bold="true" Text="Delete Resume" runat="server"
OnClick="btnDel_Click"></asp:Button>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td align="center">
<asp:Label ID="lblmsg" runat="server" Font-Bold="True" ForeColor="Red" Visible="False"
Height="17px" Width="855px"></asp:Label>
</td>
</tr>
<tr>
<td align="center">
<span class="txt">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<%--<ajaxToolkit:AsyncFileUpload ID="fpResumenew" runat="server" Visible="false" />--%>
<asp:FileUpload ID="fpResumenew" runat="server" Visible="false" Width="226px" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
</asp:UpdatePanel>
</span>
</td>
</tr>
<tr>
<td align="center">
</td>
</tr>
<tr>
<td style="vertical-align: top" align="center">
<%--<asp:Button ID="btnUpload" Font-Bold="true" DisabledText="Processing..." Visible="false"
Text="Upload" BackColor="Maroon" ForeColor="White" runat="server" OnClick="btnUpload_Click" />--%>
<cc1:ClickOnceButton ID="btnUpload" Font-Bold="true" DisabledText="Processing..."
Visible="false" Text="Upload" BackColor="Maroon" ForeColor="White" runat="server"
OnClick="btnUpload_Click" DisableAfterClick="True" />
</td>
</tr>
</table>
protected void btn_Click(object sender, EventArgs e)
{
string strfilename = fp.FileName.ToString();
if (fp.PostedFile.FileName.Trim().Length != 0)
{
binary = new byte[fp.PostedFile.ContentLength];
binary = fp.FileBytes;
doc = fp.FileName;
contenttype = fp.PostedFile.ContentType;
}
}
Just a sample!!!
Nothing works for me.. Problem is that I'm using three more buttons in the same page. The other buttons initializing the file upload control. So, when clicking the upload button, the file name is empty. So, I used another page for uploading the word document. Now, it is working.. !! Anyhow, I need the solution for this!! Anyone give me idea!!
Hai vaishu
FileUpload controls are not compatible with UpdatePanel when they are used to upload files as part of an asynchronous postback.
Just check the AJAX documentation. The FileUpload control is not supported inside an UpdatePanel (http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx):
or
use asp:postbacktrigger instead of asyncpostbacktrigger
<asp:updatepanel runat="server" id="UpdatePanel1">
<contenttemplate>
<asp:FileUpload runat="server" id="FileUpload1" />
<asp:button runat="server" id="ButtonSubmit" text="Postback" />
</contenttemplate>
<triggers>
<asp:postbacktrigger controlid="ButtonSubmit" />
</triggers>
</asp:updatepanel>
or
use ajax for asynchronous file upload:
http://www.asp.net/(S(fu2l2uzphr2u3u45q2dnez55))/ajax/AjaxControlToolkit/Samples/AsyncFileUpload/AsyncFileUpload.aspx
The reason that the postback trigger is not working in your case is because the FileUpload Control is set to visible=false. If you use display:none instead, the postback trigger will work.
This works just fine, I finally solved the issue... the ButtonSubmit is reload by the trigger so the page got the info from the control.
<asp:updatepanel runat="server" id="UpdatePanel1">
<contenttemplate>
<asp:FileUpload runat="server" id="FileUpload1" />
<asp:button runat="server" id="ButtonSubmit" text="Postback" />
</contenttemplate>
<triggers>
<asp:postbacktrigger controlid="ButtonSubmit" />
</triggers>
</asp:updatepanel>