I have a nested gridview of images that are associated with the parent grid's row on a one to many relationship. This structure is contained in a user control. The images are uploaded with a fileupload control and are stored in a folder on the server. When the image grid's row is deleted, I delete the image from the server in the OnRowDeleting event. What's weird is that when you delete a row, a postback occurs and the OnRowDeleting event fires, the record is deleted from the database, but the row does not go away from the UI until you then delete it a second time. What's even weirder is that when I comment out the code in the OnRowDeleting event, the row deletes immediately. What's going on here?
<%# Control Language="C#" AutoEventWireup="true" CodeFile="OrderItemView.ascx.cs" Inherits="Controls_OrderItemView" EnableTheming="true" EnableViewState="true"%>
<asp:GridView ID="OrderItemList" runat="server" AutoGenerateColumns="False"
DataKeyNames="Id,ConcurrencyId" DataSourceID="OrderItemDataSource"
SkinID="Blue" OnRowDataBound="OrderItemList_RowDataBound"
EnableModelValidation="True" Width="100%"
OnRowUpdating="OrderItemList_RowUpdating"
OnRowUpdated="OrderItemList_RowUpdated" AllowSorting="True" >
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="ImageButtonConfirmDelete" runat="server"
CausesValidation="False" CommandName="Delete" ImageUrl="../Images/Grid_ActionDelete.gif"
OnClientClick='return confirm("Are you sure you want to delete this Order Item? This cannot be undone.");'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Item Name" SortExpression="OrderItemName">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("OrderItemName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Images">
<ItemTemplate>
<a href="" data-id='<%# Eval("id","imageHeader_{0}") %>' class="expandImages">
<asp:Label ID="Label3" runat="server"
Text='<%# string.Format("{0} Image{1}", Helpers.GetImageCount(new Guid(Eval("Id").ToString())), Helpers.GetImageCount(new Guid(Eval("Id").ToString())) != 1 ? "s" : "") %>'>
</asp:Label>
</a>
<div id='<%# Eval("id","images_{0}") %>' class="imageDisplay">
<asp:GridView ID="gvImages" runat="server" SkinID="Blue"
DataKeyNames="Id" EnableModelValidation="True"
DataSourceID="ImageDataSource" AutoGenerateColumns="False"
ShowHeader="False" onrowdeleting="gvImages_RowDeleting">
<Columns>
<asp:TemplateField ShowHeader="false">
<ItemTemplate>
<asp:ImageButton ID="ImageButtonConfirmDeleteImage" runat="server"
CausesValidation="False" CommandName="Delete" ImageUrl="../Images/Grid_ActionDelete.gif"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="false">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("FileName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<a href="" data-id='<%# Eval("id","image_{0}") %>' onclick='showImage("<%# Eval("ImageUrl") %>"); return false;'>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("FileName") %>' ToolTip="Click to Preview Image"></asp:Label>
</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<div style="color: Blue; font-style: italic;">No Images</div>
</EmptyDataTemplate>
</asp:GridView>
<asp:FileUpload ID="FileUpload1" runat="server"/>
<asp:Button ID="btnUploadImage" runat="server" Text="Upload" CommandArgument='<%# Eval("Id") %>'
CommandName="orderItemId" oncommand="btnUploadImage_Command"/>
<asp:ObjectDataSource ID="ImageDataSource" runat="server"
DataObjectTypeName="OrderSite.Entities.OrderItemImage"
DeleteMethod="Delete" InsertMethod="Save"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetList"
TypeName="OrderSite.Bll.OrderItemImageManager" UpdateMethod="Save"
SelectCountMethod="SelectCountForGetList">
<SelectParameters>
<asp:Parameter DbType="Guid" Name="orderItemId"/>
</SelectParameters>
</asp:ObjectDataSource>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<div style="padding: 3px 0 3px 3px 3px;">No Order Items Exist</div>
</EmptyDataTemplate>
</asp:GridView>
<asp:ObjectDataSource ID="OrderItemDataSource" runat="server"
DataObjectTypeName="OrderSite.Entities.OrderItem"
DeleteMethod="Delete" InsertMethod="Save"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetList"
TypeName="OrderSite.Bll.OrderItemManager" UpdateMethod="Save"
OnInserting="OrderItemDataSource_OnInserting"
SortParameterName="sortExpression" SelectCountMethod="SelectCountForGetList">
<SelectParameters>
<asp:Parameter DbType="Guid" Name="orderFormId" />
<asp:Parameter Name="sortExpression" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
I commented out any containing updatepanels in the parent page as they can always be the culprit, but there was no effect.
Here is the OnRowDeleting event:
protected void gvImages_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
// Also delete the file from the images folder
OrderItemImage myImage = OrderItemImageManager.GetItem((Guid)e.Keys["Id"]);
if (myImage != null)
{
string path = string.Format("../Images/OrderItemImages/{0}", myImage.OrderItemId.ToString());
if (File.Exists(Server.MapPath(string.Format("{0}/{1}", path, myImage.FileName))))
{
File.Delete(Server.MapPath(string.Format("{0}/{1}", path, myImage.FileName)));
// if there are no images left in folder, then delete it (only deletes empty directory)
if (Directory.GetFiles(Server.MapPath(path), "*.*", SearchOption.TopDirectoryOnly).Length == 0)
Directory.Delete(Server.MapPath(path));
}
OrderItemList.DataBind();
}
}
I've done this before and have had no issues, so any help would be greatly appreciated!
I ended up wrapping the nested GridView ("gvImages"), the FileUpload, and Button in a user control, and now it works great. I didn't change any of the code, just wrapped it all in the user control, so go figure.
Related
I have a gridview with 2 columns ([+] and [data]). On click of [+] sign it opens a girdview inside the same gridview.
Now, in child gridview I have a link button, on click of that I display some data. On postback the gridview retains its original position, I want to show the child gridview as it is.
Code.
<asp:GridView ID="grvNeverTouchedQuartile" class="form-table" Width="100%" OnRowCommand="grvNeverTouchedQuartile_RowCommand"
AutoGenerateColumns="false" runat="server" OnRowDataBound="grvNeverTouchedQuartile_RowDataBound"
DataKeyNames="QuartileType">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%--<asp:LinkButton ID="lnkbtnNTQuartile" runat="server" Text='<%# Eval("Quartile") %>'
CommandArgument='<%# Eval("QuartileType") %>' CommandName="NeverTouched"></asp:LinkButton>--%>
<img alt="Image not available" style="cursor: pointer" src="../images/plus.png" />
<asp:Panel ID="pnl_NTChildGrid" runat="server" Style="display: none">
<table>
<tr>
<td>
<div style="overflow: auto;">
<asp:GridView ID="grdNTInsuranceData" runat="server" AutoGenerateColumns="false" OnRowCommand="grdNTInsuranceData_RowCommand">
<Columns>
<asp:TemplateField HeaderText="Insurance Name">
<ItemTemplate>
<asp:Label ID="lblNTQuartileType" runat="server" Text='<%# Eval("QuartileType") %>' Visible="false"></asp:Label>
<asp:Label ID="lblNTInsuranceName" runat="server" Text='<%# Eval("InsuranceName") %>' Visible="false"></asp:Label>
<asp:LinkButton ID="lnkbtnNTInsuranceQuartile" runat="server" Text='<%# Eval("InsuranceNameDetails") %>'
CommandArgument='<%# ((GridViewRow) Container).RowIndex %>' CommandName="NeverTouchedInsurance"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</td>
</tr>
</table>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Quartile[Count - $Value]">
<ItemTemplate>
<asp:Label ID="lblNTQuartile" runat="server" Text='<%# Eval("Quartile") %>'></asp:Label>
<%--<asp:LinkButton ID="lnkbtnNTQuartile" runat="server" Text='<%# Eval("Quartile") %>'
CommandArgument='<%# Eval("QuartileType") %>' CommandName="NeverTouched"></asp:LinkButton>--%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Thanks in Advance!!!
There are some ways (This is not with code it is just my suggestions, there are codes over internet or it is based on experience) so in my opinion you can use one of below cases:
1- You should use UpdatePanel to prevent refreshing page and put the grid inside UpdatePanel, just for sample like below:
<asp:UpdatePanel ID="panelId" UpdateMode="Conditional" runat="server" >
<ContentTemplate>
<asp:GridView ID="gvPrList" runat="server" AutoGenerateColumns="false" AllowPaging="false"
AllowSorting="false" CssClass="list-table" HeaderStyle-CssClass="header">
<Columns>
<ItemTemplate>
<asp:LinkButton ID="lnkbtnNTInsuranceQuartile" runat="server" Text='<%# Eval("InsuranceNameDetails") %>'
CommandArgument='<%# ((GridViewRow) Container).RowIndex %>' CommandName="NeverTouchedInsurance"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
2- the runat of lnkbtnNTInsuranceQuartile is server which main after it's click post-back will be occurred so page get refreshed for this you can change your lnkbtnNTInsuranceQuartile to HTML element such as <div><a class="x">click here</a><span class="detail"/></div> and then instead of lnkbtnNTInsuranceQuartile click use ajax and then update details Span something like :
$('.x').click(function () {
var $me = this;
$.ajax({
url: 'Your Web Method address',
data: { youData},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
//update span here
$me.parent().find('.details.'.html(your response);
},
error: function (x, e) {
}
});
});
3- Use client-side Grid not ASP.Net GridView
4- Add collapsed th's id into localstorage and after page load open it again...
5- etc...
all three above steps can be implemented based on your scenario...
Hope will help you
working on an ASP Gridview querying a SQL server base.
<asp:Content ID="i_cttContenu" runat="server" ContentPlaceHolderID="i_cphContenu">
<asp:SqlDataSource ID="i_sdsGvOption" runat="server" ConnectionString="<%$ ConnectionStrings:... %>"
SelectCommand=" SELECT * FROM MyTable " SelectCommandType="Text"
UpdateCommand="UPDATE MyTable SET [name] = #name, prenom = #prenom, isAlive = #isAlive WHERE idWsgProgramOption = #idWsgProgramOption" UpdateCommandType="Text"
</asp:SqlDataSource>
<asp:UpdatePanel ID="i_up" runat="server">
<ContentTemplate>
<asp:GridView ID="i_gvOption" runat="server" AutoGenerateColumns="False" DataKeyNames="idWsgProgramOption"
DataSourceID="i_sdsGvOption" EnableModelValidation="True">
<Columns>
<asp:CommandField ButtonType="Image" CancelImageUrl="~/....gif"
CancelText="Annuler" EditImageUrl="~/....gif"
EditText="Update" HeaderText="M" UpdateImageUrl="~/....gif"
UpdateText="Save">
</asp:CommandField>
<asp:TemplateField HeaderText="Nom" SortExpression="name">
<ItemTemplate>
<asp:HyperLink ID="i_hlOption" runat="server" NavigateUrl='<%# Eval("idWsgProgramOption", "~/myURL") %>'
Text='<%# Eval("name") %>' />
</ItemTemplate>
<EditItemTemplate>
<table >
<tr>
<td >
<asp:TextBox ID="i_tbNom" runat="server" Text='<%# Bind("name") %>' />
</td>
</tr>
</table>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="prenom" SortExpression="prenom">
<ItemTemplate>
<asp:HyperLink ID="i_hlprenom" runat="server" NavigateUrl='<%# Eval("prenom", "~/myURL") %>'
Text='<%# Eval("prenom") %>' />
</ItemTemplate>
<EditItemTemplate>
<table >
<tr>
<td >
<asp:TextBox ID="i_tbprenom" runat="server" Text='<%# Bind("prenom") %>' />
</td>
</tr>
</table>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Obligatoire" >
<ItemTemplate>
<asp:CheckBox ID="CB_id1" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="CB_id2" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
The update() method is not invoked when I click the update button (first column). If I add an onUpdating event into the datasource, the corresponding method is never invoked.
The code causing the issue is definitely the checkbox.
If I remove from the datasource update query:
, isAlive = #isAlive
and only set:
UPDATE MyTable SET [name] = #name, prenom = #prenom, isAlive = #isAlive WHERE idWsgProgramOption = #idWsgProgramOption;
Then it updates fine (except the isAlive field of course).
I am 100% sure that the isAlive field exists into the base (bit type).
So it looks that my problem comes from this bloc:
<asp:TemplateField HeaderText="Obligatoire" >
<ItemTemplate>
<asp:CheckBox ID="CB_id1" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="CB_id2" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
Is there anything obvious that I missed??
Also, this is the simplified code, but if I set the "checked" property to the checkbox and correctly binds, the rows checkbox is correctly field. So the issue does not affect the select but only the update.
Try a button column instead so you can specify the specific command names.
<asp:ButtonField ButtonType="Link" Text="Update" CommandName="Update" />
<asp:ButtonField ButtonType="Link" Text="Delete" CommandName="Delete" />
Take action based on e.CommandName.
I am working on an asp.net application. In which i have added a commandbutton which is used to edit the row. My Gridview is
<asp:GridView ID="gvCustomerPaymentDetails" runat="server"
AutoGenerateColumns="false" ShowFooter="true" OnRowEditing="EditPayment"
OnRowUpdating="UpdatePayment" OnRowCancelingEdit="CancelEdit"
CssClass="table table-bordered table-hover" Style="margin-left: 5px; margin-right: 5px;">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%# Eval("ID")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="2%" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Pay Amount">
<ItemTemplate>
<asp:Label ID="lblPayAmount" runat="server" Text='<%# Eval("Pay_Amount")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtPayAmount" runat="server" style="width:100%" Text='<%# Eval("Pay_Amount")%>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtPayAmount" style="width:100%" runat="server"></asp:TextBox> </FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<asp:LinkButton ID="linkPayNow" runat="server" Text="Pay Now" CommandArgument='<%#Eval("ID") %>' CommandName="Pay"></asp:LinkButton>
<asp:Label ID="txtStatus" runat="server" Text="Paid" Style="margin-left: 20px;" Visible="false"></asp:Label>
<asp:LinkButton ID="lnkRemove" runat="server" CommandArgument='<%# Eval("ID")%>' OnClientClick="return confirm('Do you want to delete?')"
Text="Delete" OnClick="DeletePayment"></asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="AddNewPayment" CommandName="Footer" />
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
</Columns>
<EmptyDataTemplate>
<tr>
<th scope="col">Pay Amount
</th>
<th scope="col"></th>
</tr>
<tr>
<td>
<asp:TextBox ID="txtPayAmount" runat="server" />
</td>
<td>
<asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="AddNewPayment" CommandName="EmptyDataTemplate" />
</td>
</tr>
</EmptyDataTemplate>
</asp:GridView>
I have a Label "lblStatus" which will be either 0 or 1. If its value is 1, then i want to visible false the Update and edit commandbutton of that specific row. I have searched a lot but not found any perfect solution. Please help me someone.
In this case, I would convert the CommandField to TemplateFields. To do so, you will click on the smart tag in the gridview in design view. What this will do is change the commandfields to linkbuttons, where you can set it to false in the behind code. You will want to give your new linkbuttons proper ID's so you can find them in the behind code. Then you will create a databound method.. like..
protected void GridView1_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
//Code Here to Disable button. I'd use a Foreach loop like this.
foreach(GridViewRow gvr in GridView1.Rows)
{
Label label = ((Label)gvr.FindControl("label"));
LinkButton edit = ((LinkButton)gvr.FindControl("edit"));
if (label.Text == 1)
{
edit.Visible = false;
}
}
}
Hopefully this puts you in the right direction. I think this should do the trick.
I have two file upload controls inside GridViewControl for uploading files, I have a button for uploading files inside gridview, I am using its RowCommandEvent for uploading files. How can I get values of fileupload controls in RowCommandEvent?
This is my GridView
<asp:GridView ID="DgFiles" runat="server" AutoGenerateColumns="false" OnRowCommand="DgFiles_RowCommand">
<Columns>
<asp:TemplateField HeaderText="Crime" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="category" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Category") %>' ></asp:Label><br/>
<asp:FileUpload ID="file1" runat="server" /><br />
<asp:FileUpload ID="file2" runat="server" />
<asp:Button ID="btnupload" runat="server" CommandName="upload" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lbldate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="City" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblcity" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "City") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
and my RowCommandEvent
protected void DgFiles_RowCommand(Object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "upload")
{
}
}
I have to display records in GridView like structure, with file upload control inside it, If there is alternate way I can do it, kindly suggest.
First,
You have to add a command column with command name upload
second,
You have to find the control inside the row by using parent property.
FileUpload fl1 = (FileUpload)e.Row[rowindex].Cells<cellindex>.FindControl("File1")
FileUpload fl2 = (FileUpload)e.Row[rowindex].Cells<cellindex>.FindControl("File2")
Now You can use fl1 and fl2 as your filecontrols.
I am having an issue getting the popup to appear at all. Once I can get the popup to show at all, I can troubleshoot from there. Basically, I have a gridview and I want a detailsview to appear in a popup when I select a link. This is all being done using an objectdatasource.
Note:The grid and the detailsview work just fine if I don't try to use a modalpopupextender.
My question is whether anyone can tell me what I am doing wrong in my code, or offer a better solution for implementing the ajax modalpopupextender.
~This is a shortened version of my markup~
<asp:Content ID="Content2" ContentPlaceHolderID="MasterContentPlaceHolder" Runat="Server">
<asp:ScriptManager ID="script1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
DataSourceID="ObjectDataSource1" AllowSorting="True"
CssClass="grid" CaptionAlign="Left" DataKeyNames="APP,ENV" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
>
<Columns>
<asp:TemplateField ShowHeader="False" Visible = "false">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
CommandName="Select" Text="Select" Visible ="false"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="APP" SortExpression="APP">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Visible = "false" Text='<%# Bind("APP") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="Label1" runat="server" CausesValidation ="false" CommandName="Select" Text='<%# Bind("APP") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ENV" HeaderText="ENV"
SortExpression="ENV" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Panel ID="pnlPopup" runat="server" Width= "700px" style="display:none;">
<asp:UpdatePanel ID="detailspanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btnShowPopup" runat="server" style="display:none" />
<ajaxToolkit:ModalPopupExtender ID="mdlPopup" runat="server"
TargetControlID="btnShowPopup" PopupControlID="pnlPopup"
/>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="ObjectDataSource2" CssClass="detail"
>
<Fields>
<asp:BoundField DataField="APP" HeaderText="APP"
SortExpression="APP" />
<asp:BoundField DataField="ENV" HeaderText="ENV"
SortExpression="ENV" />
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True"
CommandName="Update" Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
CommandName="Select" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
SelectMethod="GetApplication"
TypeName="Applications.BusinessServices.AppService"
DataObjectTypeName="Applications.Entities.Application"
UpdateMethod="Update">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="APP"
PropertyName="SelectedDataKey[0]" Type="String" DefaultValue="Null" />
<asp:ControlParameter ControlID="GridView1" Name="ENV"
PropertyName="SelectedDataKey[1]" Type="String" DefaultValue=" Null" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetAllApplication"
TypeName="Applications.BusinessServices.AppAvailService" SortParameterName="sortColumn">
</asp:ObjectDataSource>
</asp:Content>
To sum it up, when the linkbutton label1 is clicked, the modalpopup should appear and show the detailsview.
~This is my codebehind~
protected void Page_Load(object sender, EventArgs e)
{
if (GridView1.SelectedIndex == -1)
{
GridView1.EnablePersistedSelection = true;
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
this.DetailsView1.Visible = true;
this.DetailsView1.DataBind();
this.detailspanel.Update();
this.mdlPopup.Show();
}
}
I have confirmed via debugging that that mdlPopup.Show() does execute when the link is clicked, and visual studio does not register any errors. It is simply that nothing happens.
Also, Btnshowpopup is just a fake button. The popup should still show if I call mdlpopup.show(); from codebehind. Even if set the panel and btnshowpopupp to visible and then click the button, nothing still happens.
Any help would be appreciated. Thanks.
I've resolved my issue. I figured that I would share it for anyone that has a similar issue.
I've seen 12 examples on various sites that show this not to be an issue, but I took the modalpopupextender outside of the updatepanel and the issue was resolved. So at least for me, the modalpopupextender has to be outside of the updatepanel in order for it to fire.