1

I am sorry I am repeating this question. Rather, I am having to repeat it. The last time I posted this, I dint get an answer. I have googled for more than 3 hrs, dint find an answer. Heres the html for the linkbutton and the modal popup. The link button is inside/on a tab panel and auto postback is set to true.

<asp:LinkButton ID="lnkAddNewAddress" runat="server" OnClick="lnkAddNewAddress_Click">Click Here To Add New Address</asp:LinkButton>
                                        <asp:ModalPopupExtender ID="lnkAddNewAddress_ModalPopupExtender" runat="server" BackgroundCssClass="modalBackground"
                                            DynamicServicePath="" Enabled="True" PopupControlID="pnlMyAddressBook" TargetControlID="lnkAddNewAddress"
                                            ViewStateMode="Enabled" >
                                        </asp:ModalPopupExtender>

I want the clickevent of the linkbutton to fire which is not happening. However clicking on the link does open the modal popup extender (which is also something I want)... How do I get into the click event. I know that a postback is being avoided here because of the modal popup probably...but I dont the solution for it....

The code on save button:

  if(hdnfld.Value.ToString()!=null)
        { 
            if(hdnfld.Value.ToString()=="Save")
        {
            SaveNewAddress(); 

        }
        else
        {
            UpdateAddress();

        }




 <%@ Page StylesheetTheme="" Title="" Language="C#" MasterPageFile="~/Site.Master"
AutoEventWireup="true" CodeBehind="frmMyAccountMyProfile.aspx.cs"   Inherits="WebApplication1.frmMyAccountMyProfile" %>

 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
 <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
  <script type="text/javascript">

    function CheckType(type) 
    {
        document.getElementById("hdnfld").value = type;
        alert(document.getElementById("hdnfld").value);
        return false;
    }



</script>
<link href="Styles/myStyleSheet.css" rel="stylesheet" type="text/css" />

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div class="divwrap">
    <table style="width: 100%; margin-right: 0px;">
        <tr>.........
<td>
        &nbsp;<asp:LinkButton ID="lnkAddNewAddress" runat="server" OnClientClick="return CheckType('Save');">Click Here To Add New Address</asp:LinkButton>
       <asp:HiddenField ID="hdnfld" runat="server" />
  <asp:ModalPopupExtender ID="lnkAddNewAddress_ModalPopupExtender" runat="server" BackgroundCssClass="modalBackground" DynamicServicePath="" Enabled="True" PopupControlID="pnlMyAddressBook" TargetControlID="lnkAddNewAddress"
                                                        ViewStateMode="Enabled">
                                                    </asp:ModalPopupExtender>

  &nbsp;...........
                                                <asp:Button ID="btnEdit" runat="server" CssClass="roundcorner btn" OnClick="btnEdit_Click" OnClientClick="return CheckType('Edit');" Text="Edit" />
                                                    &nbsp;
                                                    <asp:Panel ID="pnlMyAddressBook" runat="server" BackColor="White" CssClass="roundcorner">
4

2 に答える 2

0

これを試して:

<asp:LinkButton ID="lnkAddNewAddress" runat="server" OnClick="lnkAddNewAddress_Click">Click Here To Add New Address</asp:LinkButton>

<asp:ModalPopupExtender ID="lnkAddNewAddress_ModalPopupExtender" runat="server" BackgroundCssClass="modalBackground"
        DynamicServicePath="" Enabled="True" PopupControlID="pnlMyAddressBook" TargetControlID="btnHidden">
    </asp:ModalPopupExtender>

<asp:Button ID="btnHidden" runat="server" style="Display:none;" Text="Button"/>

コードビハインド:

protected void lnkAddNewAddress_Click(object sender, EventArgs e)
    {
        lnkAddNewAddress_ModalPopupExtender.Show();

    }
于 2013-03-30T07:00:58.330 に答える