I have a gridview and i have two buttons edit and delete.Once i click on edit button, i take the values and put those in textboxes outside grid and visible update and cancel button. but that does not fires..
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Panel ID="pnladdproduct" runat="server">
<div class="mws-form-col-1-8">
<asp:Label ID="Label11" runat="server" AssociatedControlID="btnAddProduct"> </asp:Label>
<div class="mws-form-item large">
<asp:Button ID="btnAddProduct" ValidationGroup="grpProduct" runat="server" CssClass="mws-button red" Text="Add" OnClick="btnAddProduct_Click" />
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnlUpdateProduct" runat="server">
<div class="mws-form-col-1-8">
<asp:Label ID="Label12" runat="server" AssociatedControlID="btnUpdateProduct"> </asp:Label>
<div class="mws-form-item large">
<asp:Button ID="btnUpdateProduct" runat="server" CausesValidation="False" CssClass="mws-button blue" Text="Update" OnClick="btnUpdateProduct_Click" />
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnlCancel" runat="server">
<div class="mws-form-col-1-8">
<asp:Label ID="Label13" runat="server" AssociatedControlID="btnCancelUpdate"> </asp:Label>
<div class="mws-form-item large">
<asp:Button ID="btnCancelUpdate" CausesValidation="False" runat="server" CssClass="mws-button gray" Text="Cancel" OnClick="btnCancelUpdate_Click" />
</div>
</div>
</asp:Panel>
<div class="mws-form-col-8-8">
<asp:GridView ID="grdProduct" ShowHeaderWhenEmpty="True" CssClass="mGrid" runat="server" AutoGenerateColumns="False" AllowPaging="True" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="grdProduct_PageIndexChanging" OnRowDeleting="grdProduct_RowDeleting" OnRowEditing="grdProduct_RowEditing">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Product" SortExpression="Product" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" />
<asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Rate" />
<asp:BoundField DataField="Amount" HeaderText="Amount" SortExpression="Amount" />
<asp:ButtonField ButtonType="Image" CommandName="Edit" HeaderText="Edit" ImageUrl="~/css/icons/16/edit.png" ShowHeader="True" Text="Edit" />
<asp:ButtonField ButtonType="Image" CommandName="Delete" HeaderText="Delete" ImageUrl="~/css/icons/16/delete.png" ShowHeader="True" Text="Delete" />
<asp:TemplateField HeaderText="HiddenColumn">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<asp:HiddenField ID="hdfProductID" runat="server" Value='<%# Bind("ProID") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No Products Added !!
</EmptyDataTemplate>
</asp:GridView>
<div class="mws-form-row inline">
<asp:Label ID="Label15" runat="server" AssociatedControlID="txtQuantity">Total Amount</asp:Label>
<div class="mws-form-item medium">
<asp:TextBox ID="txtTotalAmount" BackColor="Beige" BorderColor="red" ReadOnly="True" CssClass="mws-textinput" runat="server"></asp:TextBox>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnUpdateProduct" EventName="Click"/>
<asp:PostBackTrigger ControlID="btnCancelUpdate" />
</Triggers>
</asp:UpdatePanel>
Server side Code..
protected void grdProduct_RowEditing(object sender, GridViewEditEventArgs e)
{
Session["proID"] = StepGetHiddenValuesFromGridControl(e.NewEditIndex);
txtQuantity.Text = grdProduct.Rows[e.NewEditIndex].Cells[1].Text;
txtRate.Text = grdProduct.Rows[e.NewEditIndex].Cells[2].Text;
txtAmount.Text = grdProduct.Rows[e.NewEditIndex].Cells[3].Text;
txtQuantity.BackColor = Color.Beige;
txtRate.BackColor = Color.Beige;
txtAmount.BackColor = Color.Beige;
//pnladdproduct.Visible = false;
//pnlUpdateProduct.Visible = true;
//pnlCancel.Visible = true;
}
protected void btnUpdateProduct_Click(object sender, EventArgs e)
{
// this code not firing
}
I don't think there's a need for triggers.
Related
I am using VS2019.
I am new to web development.
I have a gridview which is displaying information from my db. I'm currently having issues with resizing the gridview as my buttons are being made small.
I would like to know how to ensure the gridview resizes automatically.
Thanks
Below is my ASP Code:
<link href="Content/Style.css" rel="stylesheet" />
<div class="container" style="margin-top: 5%">
<div class="rows">
<div class="col-md-12">
<div class="table-responsive">
<asp:GridView ID="GridView1" runat="server" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" AutoGenerateColumns="false" CssClass="mydatagrid" AllowPaging="true" PageSize="10" OnPageIndexChanging="GridView1_PageIndexChanging" PagerStyle-CssClass="pager" HeaderStyle-CssClass="header" RowStyle-CssClass="rows" Width="991px" OnRowCommand="OnRowCommand" >
<Columns>
<asp:BoundField DataField="id" HeaderText="ID"/>
<asp:BoundField DataField="user_name" HeaderText="User Name"/>
<asp:BoundField DataField="user_displayName" HeaderText="Display Name"/>
<asp:BoundField DataField="user_userPartition" HeaderText="Partition"/>
<asp:BoundField DataField="group_name" HeaderText="Group"/>
<asp:BoundField DataField="createdDate" HeaderText="Created Date" />
<asp:TemplateField ShowHeader="False" >
<ItemTemplate >
<asp:Button ID="Button1" runat="server" CausesValidation="false" CommandName="Approve" Text="Approve" OnClick = "Row_Selected" CommandArgument='<%# Eval("id") %>' CssClass="button-container" Visible="True" />
<asp:Button ID="Button2" runat="server" CausesValidation="false" CommandName="Decline" Text="Decline" OnClick = "Row_Selected" CommandArgument='<%# Eval("id") %>' CssClass="button-container-decline" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
I was able to adjust the grid by adding ItemStyle-width="10%"
Thanks
I have an update panel that includes a gridview with two buttons and a modal popup. When the user clicks btnView, the modal popup appears displaying the relevant information.
My issue is that I have been trying to get the updateprogress to appear during the partial postback and so far have not managed it. I should mention that the same UpdateProgress code does work in a test page that just comprises of a button with a sleep function in the code behind. Here is the html:
<!-- Placing the GridView in UpdatePanel-->
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gv" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" DataKeyNames="GroupID" GridLines="Both"
BorderWidth="1px" CellPadding="2" ForeColor="Black" OnRowDataBound="gv_RowDataBound" BorderStyle="Double" HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center" AllowSorting="True" CssClass="gvformat">
<AlternatingRowStyle BackColor="#95B9B9" />
<HeaderStyle BorderStyle="Double" BorderColor="Black"/>
<Columns>
<asp:BoundField DataField="FinancialYear" HeaderText="Financial Year" ItemStyle-HorizontalAlign="Center"/>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Button ID="btnView" runat="server" Text="view" OnClick="btnComments_Click" CausesValidation="false" Font-Names="Trebuchet MS" CssClass="btn btn-info" Font-Bold="True" />
</ItemTemplate>
<HeaderTemplate>Comment</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
<ItemTemplate>
<asp:Button ID="btnDetail" runat="server" Text="view" OnClick="btnDetails_Click" CausesValidation="false" Font-Names="Trebuchet MS" CssClass="btn btn-comment" ForeColor="White" Font-Bold="True" />
</ItemTemplate>
<HeaderTemplate>Details</HeaderTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="bttnHidden" runat="Server" Style="display: none" />
<br />
<asp:Panel ID="pnlComment" runat="server" Width="650px" Height="620px" Style="display: none;" CssClass="modalBox">
<table border="1" class="commentTable" style="border-collapse: separate; border-spacing: 10px; width:100%; height:100%">
<tr><th><asp:Label ID="lblComments" runat="server" Text="Comments" Font-Size="Medium"></asp:Label></th></tr>
<tr><td>
<asp:TextBox ID="txtExistingComments" runat="server" TextMode="MultiLine" ReadOnly="True" CssClass="content" Rows="12" Font-Names="Trebuchet MS"></asp:TextBox>
</td></tr>
<tr><th><asp:Label ID="lblNewComment" runat="server" Text="Add Comment" Font-Size="Medium"></asp:Label></th></tr>
<tr><td>
<asp:TextBox ID="txtNewComments" runat="server" TextMode="MultiLine" ReadOnly="False" CssClass="content" Rows="12" Font-Names="Trebuchet MS"></asp:TextBox></td></tr>
<tr><td>
<asp:Button ID="btnSave" runat="server" width="100px" Text="Save" OnClick="btnSave_Click" CssClass="btn btn-comment" ValidationGroup="SaveComment" ForeColor="White" Font-Bold="True" />
<asp:Button ID="btnCancel" runat="server" width="100px" Text="Cancel" CssClass="btn btn-comment" ForeColor="White" Font-Bold="True"/></td></tr>
<tr>
<td>
<asp:RequiredFieldValidator ID="rfValidator" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="txtNewComments"
ForeColor="Black" ValidationGroup="SaveComment" Font-Bold="True">You must enter a comment!</asp:RequiredFieldValidator>
</td>
</tr>
</table>
</asp:Panel>
<cc1:ModalPopupExtender ID="modal" runat="server" TargetControlID="bttnHidden" PopupControlID="pnlComment" CancelControlID="btnCancel" BackgroundCssClass="modalBackground"></cc1:ModalPopupExtender>
<br />
<asp:HiddenField ID="Hidden" runat="server" value="-1"/>
<asp:HiddenField ID="bStatus" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" ChildrenAsTriggers="false" UpdateMode="Conditional" DisplayAfter="10">
<ProgressTemplate>
<div class="center">
<asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/Images/loader.gif" AlternateText="Please wait ..." ToolTip="Please wait ..." />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</asp:Content>
Any help would be most appreciated!
two points you need to check.
First if you have any javascript errors - this Update Progress is base on javascrip, so any javascript error can stop the function of it. Open the console panel and check for javascript errors...
The second point is to check the DisplayAfter property on UpdateProgress, that is 500 milliseconds default value. If anything happens within this time, the UpdateProgress is not show. So add a lower value on DisplayAfter to check it out.
I have a multiple records in a Grid view inside an update panel, Grid-view has ImageButton , onclick of this button I am displaying a ModalPopupExtender to display details of selected row. Then I close the dialog using close button.
Everything works fine until I open and close the modelpopup 10 times , after that page styles gets disturbed and page start looking ugly. When I remove the update panel then everything works fine but I need update panel for smooth UI experience.
My code is below, please help me as soon as possible , I am stuck because of this. temporarily , I am handling this by dopostback on 10th time so that user doesn't experience refresh everytime.
aspx code.
<asp:UpdatePanel ID="udpDocuments" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="Content">
<h1 class="HomePageHeading">Standard Operating Procedures, Guidelines, and Policies</h1>
<div class="ClearFix MarginBottom30">
<div class="SeriesInformation">
<h2>Series</h2>
<ol class="ValueList">
<li>1.000 - <span>Personnel Procedures</span>
</li>
<li>2.000 - <span>Veterinary Care/Laboratory Animal Medicine</span>
</li>
<li>3.000 - <span>Animal Husbandry/Facility Operations</span>
</li>
<li>4.000 - <span>Safety</span>
</li>
<li>5.000 - <span>Technical Procedures</span>
</li>
<li>6.000 - <span>Administration</span>
</li>
</ol>
</div>
<div class="PolicyNumberAbbr">
<h2>SOP/Policy Number Abbreviations</h2>
<ol class="ValueList">
<li>P = <span>Policy</span>
</li>
<li>G = <span>Guidelines</span>
</li>
<li>B = <span>Bethesda</span>
</li>
<li>F = <span>Frederick</span>
</li>
</ol>
</div>
</div>
<asp:Panel ID="SearchCriteria" runat="server" DefaultButton="btnSearch">
<div class="FilterWrap" style="clear: both;">
<fieldset class="FnlFieldSet">
<legend class="Clip">Filter SOP Listings</legend>
<ol class="InputFields">
<li>
<asp:Label Text="Filter by:" runat="server" ID="lblSortOrder" AssociatedControlID="ddlSortCriteria" />
<ol class="HorizontalInput">
<li>
<asp:DropDownList ID="ddlSortCriteria" runat="server" SelectMethod="Load_Filter"
OnSelectedIndexChanged="ddlSortCriteria_SelectedIndexChanged" AutoPostBack="true"
AppendDataBoundItems="true" DataTextField="Value" DataValueField="Key">
</asp:DropDownList>
<asp:DropDownList ID="ddlCampus" Visible="false" runat="server" SelectMethod="Load_Campus" AppendDataBoundItems="true" DataTextField="value" DataValueField="key">
<asp:ListItem Text="[Select]" Value="0" />
</asp:DropDownList>
<asp:DropDownList ID="ddlSeries" Visible="false" runat="server" SelectMethod="Load_Series" AppendDataBoundItems="true" DataTextField="Name" DataValueField="Id">
<asp:ListItem Text="[Select]" Value="0" />
</asp:DropDownList>
<dms:WatermarkTextBox ID="wmTitle" runat="server" MaxLength="60" Columns="30" WatermarkText="Title" />
</li>
<li>
<span class="InputButtonWrapper HasIcon SearchIcon">
<asp:Button ID="btnSearch" Text="Search" OnClick="btnSearch_Click" runat="server" />
</span>
<asp:Button ID="btnReset" Text="Reset" OnClick="btnReset_Click" runat="server" />
</li>
</ol>
</li>
</ol>
</fieldset>
</div>
</asp:Panel>
<dms:GridView ID="gvSOPDetails" runat="server" AllowPaging="true" PageSize="50" AllowSorting="true" DataKeyNames="Id"
AutoGenerateColumns="False" SelectMethod="SopListingGrid_GetItem" Width="100%"
OnRowCommand="gvSOPDetails_RowCommand" OnRowDataBound="gvSOPDetails_RowDataBound"
ItemType="Dms.Css.Ncif.Lasp.SopTraining.Biz.LaspSopTraining.Sop">
<Columns>
<asp:TemplateField HeaderText="SOP/Policy#" SortExpression="Number">
<ItemTemplate>
<asp:Label ID="lblNumber" runat="server" Text='<%# Item.Number %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<ItemTemplate>
<asp:HyperLink runat="server" ID="lnkDeleteResponderIssueImage" NavigateUrl="<%# Item.MainFileAttachment==null?string.Empty:Item.MainFileAttachment.ResourceUrl %>" CssClass="FileDownloadLink" Target="_blank" Text='<%# Item.Title %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Revision Number" SortExpression="RevisionNumber">
<ItemTemplate>
<asp:Label ID="lblRevisionNumber" runat="server" Text='<%# Item.RevisionNumber %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Revision Date" SortExpression="RevisionDate">
<ItemTemplate>
<%# string.Format("{0:d}", Item.RevisionDate)%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Effective Date" SortExpression="EffectiveDate">
<ItemTemplate>
<%# string.Format("{0:d}", Item.EffectiveDate)%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Campus" SortExpression="LocationId">
<ItemTemplate>
<%# Dms.Framework.Extensions.EnumExtensions.Description(Item.LocationId) %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Attachments" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<asp:ImageButton ID="imgBtnViewAttachment" runat="server" CommandName="ViewAttachment"
Enabled="true" CommandArgument='<%# Item.Id %>'
Text="Delete" ImageUrl="~/Media/Images/modal-open-icon.png" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No records match your search criteria.
</EmptyDataTemplate>
</dms:GridView>
</div>
<div>
<%-- OnCancelScript="__doPostBack('Ok','')" is added to fix the issue when you open the model popup 10 times and on 11th time it mashed up the UI--%>
<asp:Button ID="btnShowModelPopup" runat="server" Text="Button" CssClass="HideModelPopupButton" />
<asp:HiddenField ID="hfSelectedSOP" runat="server" />
<cc1:ModalPopupExtender ID="mpeAttachments" runat="server"
CancelControlID="imgBtnPopupClose"
TargetControlID="btnShowModelPopup" PopupControlID="pnlAttachmentsForSelectedSOP"
PopupDragHandleControlID="PopupHeader" Drag="true"
OnCancelScript="OnCloseButtonClientClick()"
RepositionMode="RepositionOnWindowResizeAndScroll"
BackgroundCssClass="ModalPopupBG">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlAttachmentsForSelectedSOP" Style="display: none" runat="server">
<div>
<div class="PopupHeader">
<asp:ImageButton ID="imgBtnPopupClose" CssClass="ModalCloseButton" runat="server" ImageUrl="~/Media/Images/modal-close-icon.png" />
</div>
<div class="PopupBody">
<div class="PopupTitle">
<asp:Label ID="lblTitle" runat="server"></asp:Label>
<span>attachments</span>
</div>
<asp:Panel ID="pnlSupportingAttachments" runat="server">
<ul>
<asp:ListView runat="server" ID="lvSupportingAttachments" DataKeyNames="Id" ItemType="Dms.Css.Ncif.Lasp.SopTraining.Biz.LaspSopTraining.Attachment"
SelectMethod="LoadModelPopupAttachment">
<ItemTemplate>
<li>
<span>
<asp:HyperLink runat="server" ID="lnkDeleteResponderIssueImage" NavigateUrl="<%# Item.ResourceUrl %>" CssClass="FileDownloadLink" Target="_blank" Text='<%# Item.FileName %>'></asp:HyperLink>
</span>
</li>
</ItemTemplate>
</asp:ListView>
</ul>
</asp:Panel>
</div>
</div>
</asp:Panel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:HiddenField ID="closeCount" ClientIDMode="Static" Value="0" runat="server" />
<script type="text/javascript">
var count = 0;
function OnCloseButtonClientClick() {
if (count == 8) {
//__doPostBack('Ok', '');
count = 0;
}
else {
count = count + 1;
}
return false;
}
</script>
protected void gvSOPDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ViewAttachment")
{
hfSelectedSOP.Value = (string)e.CommandArgument;
mpeAttachments.TargetControlID = "btnShowModelPopup";
lvSupportingAttachments.DataBind();
mpeAttachments.Show();
}
}
Got solution, It is only about moving code around update panel:
ASPX code:
<dms:GridView ID="gvSOPDetails" runat="server" AllowPaging="true" PageSize="50" AllowSorting="true" DataKeyNames="Id"
AutoGenerateColumns="False" SelectMethod="SopListingGrid_GetItem" Width="100%"
OnRowCommand="gvSOPDetails_RowCommand" OnRowDataBound="gvSOPDetails_RowDataBound"
ItemType="Dms.Css.Ncif.Lasp.SopTraining.Biz.LaspSopTraining.Sop">
<Columns>
<asp:TemplateField HeaderText="SOP/Policy#" SortExpression="Number">
<ItemTemplate>
<asp:Label ID="lblNumber" runat="server" Text='<%# Item.Number %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Attachments" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<asp:ImageButton ID="imgBtnViewAttachment" runat="server" CommandName="ViewAttachment"
Enabled="true" CommandArgument='<%# Item.Id %>'
Text="Delete" ImageUrl="~/Media/Images/modal-open-icon.png" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No records match your search criteria.
</EmptyDataTemplate>
</dms:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Panel ID="pnlAttachmentsForSelectedSOP" Style="display: none" runat="server">
<div>
<div class="PopupHeader">
<asp:ImageButton ID="imgBtnPopupClose" CssClass="ModalCloseButton" runat="server" ImageUrl="~/Media/Images/modal-close-icon.png" />
</div>
<div class="PopupBody">
<div class="PopupTitle">
<asp:Label ID="lblTitle" runat="server"></asp:Label>
<span>attachments</span>
</div>
<asp:UpdatePanel ID="upAttachmentList" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnlSupportingAttachments" runat="server">
<ul>
<asp:ListView runat="server" ID="lvSupportingAttachments" DataKeyNames="Id" ItemType="Dms.Css.Ncif.Lasp.SopTraining.Biz.LaspSopTraining.Attachment"
SelectMethod="LoadModelPopupAttachment">
<ItemTemplate>
<li>
<span>
<asp:HyperLink runat="server" ID="lnkDeleteResponderIssueImage" NavigateUrl="<%# Item.ResourceUrl %>" CssClass="FileDownloadLink" Target="_blank" Text='<%# Item.FileName %>'></asp:HyperLink>
</span>
</li>
</ItemTemplate>
</asp:ListView>
</ul>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Panel>
<asp:Button ID="btnShowModelPopup" runat="server" Text="Button" CssClass="HideModelPopupButton" />
<asp:HiddenField ID="hfSelectedSOP" runat="server" />
<cc1:ModalPopupExtender ID="mpeAttachments" runat="server"
CancelControlID="imgBtnPopupClose"
TargetControlID="btnShowModelPopup" PopupControlID="pnlAttachmentsForSelectedSOP"
PopupDragHandleControlID="PopupHeader" Drag="true"
RepositionMode="RepositionOnWindowResizeAndScroll"
BackgroundCssClass="ModalPopupBG">
</cc1:ModalPopupExtender>
ASPX.cs: code:
protected void gvSOPDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ViewAttachment")
{
hfSelectedSOP.Value = (string)e.CommandArgument;
mpeAttachments.TargetControlID = "btnShowModelPopup";
lvSupportingAttachments.DataBind();
upAttachmentList.Update();
mpeAttachments.Show();
}
}
<asp:UpdatePanel ID="updtpnlacademic" runat="server">
<ContentTemplate>
<td>
<asp:GridView ID="gdvwAcademic1" runat="server" OnRowCommand="gdvwAcademic1_RowCommand" OnRowDeleting="gdvwAcademic1_RowDeleting" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" AllowSorting="True" AutoGenerateColumns="False" HorizontalAlign="Center">
<Columns>
....Other column fields
<asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center" ShowHeader="false">
<ItemTemplate>
<asp:ImageButton ID="imgbtnacademicdelete" CommandName="Delete" OnClick="imgbtnacademicdelete_Click" CommandArgument='<%# ((GridViewRow)Container).RowIndex %>' ToolTip="Delete" runat="server" ImageAlign="Top" ImageUrl="~/Images/delete.png" Width="30" Height="25"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="btndummy" runat="server" Visible="false" />
<cc1:ModalPopupExtender ID="mpacademic" runat="server" TargetControlID="btndummy" PopupControlID="Panel2" CancelControlID="btnacademicClose" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" HorizontalAlign="Center" style = "display:none">
<span style="color:white; font-family:'Bookman Old Style'; font-weight:bold;">Really Want To Delete This Record...!</span><br /><br /><br /><br />
<asp:Button ID="btnconfirmacademicdelete" OnClick="btnconfirmacademicdelete_Click" CssClass="BStyle" Font-Bold="true" runat="server" Text="Yes" />
<asp:Button ID="btnacademicClose" Font-Bold="true" runat="server" CssClass="BStyle" Text="Cancel" />
</asp:Panel>
</td>
</ContentTemplate>
</asp:UpdatePanel>
And following code as in the code behind ....
protected void gdvwAcademic1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
mpacademic.Show();
//System.Windows.Forms.MessageBox.Show("RowDeleting clicked after this modal popup should be displayed.....!");
}
It only show messagebox on event if uncomment messagebox but not showing modal popup
<cc1:ModalPopupExtender ID="mpacademic" runat="server" TargetControlID="btndummy" PopupControlID="Panel2" CancelControlID="btnacademicClose" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
The TargetControlID property is set to btndummy and
<asp:Button ID="btndummy" runat="server" Visible="false" />
btndummy is not rendering since Visible property is set to false.
Try to replace
<asp:Button ID="btndummy" runat="server" Visible="false" />
With
<asp:Button ID="btndummy" runat="server" style="display:none" />
I have an Ajax panel first panel inside another panel second panel and an updateProgress linked to the first panel
With this I have two problems:
The updateProgress show the progress image when the second panel updates but not when the first panel updates
To update the 2nd panel I have to press the button inside the second panel twice
<asp:UpdateProgress ID="UProc_TabContainer" runat="server" AssociatedUpdatePanelID="UP_FirstPanel"
DisplayAfter="1">
<ProgressTemplate>
<div id="dvProgress" runat="server" style="position: absolute; top: 300px; left: 450px;
text-align: center;">
<asp:Image ID="wait" runat="server" ImageUrl="~/Images/wait3.gif" Height="120px"
Width="128px" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UP_FirstPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<script language="javascript" type="text/javascript">
function divexpandcollapse(divname) {
var div = document.getElementById(divname);
var img = document.getElementById('img' + divname);
if (div.style.display == "none") {
div.style.display = "block"; img.src = "Images/Icons/minus.jpg";
} else { div.style.display = "none"; img.src = "Images/Icons/plus.jpg"; }
}</script>
<asp:DropDownList ID="DateSelection" runat="server" AutoPostBack="True" Height="21px"
Width="134px">
</asp:DropDownList>
<asp:GridView ID="GV_SL" runat="server" OnRowDataBound="gvUserInfo_RowDataBound"
OnRowCommand="GV_SL_RowCommand" AutoGenerateColumns="false" DataSourceID="SQL_Weekly">
<Columns>
<asp:TemplateField ItemStyle-Width="50px">
<ItemTemplate>
<a href="JavaScript:divexpandcollapse('div<%# Eval("name") %>');">
<img id="imgdiv<%# Eval("name") %>" width="15px" border="0" src="Images/Icons/plus.jpg" /></a></ItemTemplate>
<ItemStyle Width="40px" />
</asp:TemplateField>
<asp:BoundField DataField="name" HeaderText="Group" SortExpression="name" />
<asp:BoundField DataField="ASL" HeaderText="SL% Act" ReadOnly="True" SortExpression="ASL" />
<asp:TemplateField>
<ItemTemplate>
<tr>
<td colspan="100%">
<div id="div<%# Eval("name") %>" style="display: none; position: relative; left: 15px;
overflow: auto">
<asp:GridView ID="gvChildGrid" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Metric" HeaderText=" " HeaderStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Actual" HeaderText="Actual" HeaderStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
<br />
<asp:UpdatePanel ID="UP_SecondPanel" runat="server" UpdateMode="Always">
<ContentTemplate>
<%-- --%>
<asp:TextBox ID="TB_Comments" runat="server" Text="Example: Text will be entered here"
TextMode="MultiLine" Rows="4" Width="510px"></asp:TextBox>
<asp:Button ID="B_Save" runat="server" CommandName="AddText" CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
Text="Save Changes" />
</ContentTemplate>
</asp:UpdatePanel>
<%-- --%>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DateSelection" EventName="SelectedIndexChanged" />
</Triggers>
Any ideas on what I'm doing wrong?
Thanks
I have resolved the 1st problem presented by removing AssociatedUpdatePanelID="UP_FirstPanel" from the UpdateProgress. I hope it helps someone
I've created a separate posting with further detail and simplified code for the second problem (Nested Ajax UpdatePanel in Gridview needs button control to be clicked twice)