I am having an issue with opening a modalextender which contains a window from clicking on an ASP LinkButton on a gridview. I need to pass a value from the row to the modal page I am showing.
Here is my code for the link button in my gridview.
<asp:TemplateField ShowHeader="False">
<itemtemplate>
<asp:LinkButton ID="linkNew" CausesValidation="false" CommandName=""runat="server" Text="New Tx">
</itemtemplate>
I have
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
(e.Row.FindControl("linkNew") as LinkButton).Attributes.Add("onclick", "ShowEditModal('" + (e.Row.FindControl("lbLocator") as Label).Text + "');");
}
}
The Javascript is:
function ShowEditModal(LocatorID) {
var frame = $get('IframeEdit');
frame.src = "Receive.aspx?UIMODE=NEW&EID=" + LocatorID;
$find('EditModalPopup').show();
}
Finally the IframeEdit
<div id="DivEditWindow" style="display: none;" class="popupConfirmation">
<iframe id="IframeEdit" frameborder="0" scrolling="no" height="400" width ="600">
</iframe>
</div>
The code in Receive.aspx page is this
public enum UIMODE
{
NEW,
EDIT,
VIEW
}
public partial class Receive : System.Web.UI.Page
{
public UIMODE UIMode
{
get
{
if (ViewState["UIMODE"] == null)
ViewState["UIMODE"] = new UIMODE();
return (UIMODE) ViewState["UIMODE"] ;
}
set
{
ViewState["UIMODE"] = value;
}
}
private string EID
{
get
{
string text = (string)ViewState["EID"];
if (text != null)
return text;
else
return string.Empty;
}
set
{
ViewState["EID"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Validate();
string qsUIMODE = Request.QueryString["UIMODE"];
if (string.IsNullOrEmpty(qsUIMODE) == false)
{
UIMode = (UIMODE)Enum.Parse(typeof(UIMODE), qsUIMODE);
EID = Request.QueryString["EID"];
hdnWindowUIMODE.Value = UIMode.ToString();
}
MultiViewReceive.ActiveViewIndex = 1;
}
}
I can see the window popup correctly when the linkbutton is clicked, but it then dissapears right away and I need it to stay on the page.
Any help would be great. Please let me know if anything else is needed from my code as well.