Click here to Skip to main content
15,868,292 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C# code

C#
protected void Menu1_MenuItemClick1(object sender, MenuEventArgs e)
      {

          if (txtPolicyNumber.Text.Length == 9)
          {
              HtmlElementCollection elc = this.ieBrowser.Document.GetElementsByTagName("input");

              if (Menu1.SelectedValue == "Policy Status")
              {
                  txtCaptcha.Text = "";

                  DoccumentComplete = false;
                  navigate("https://merchant.onlinelic.in/LICMerchant/appmanager/Merchant/MerchantHome?_nfpb=true&_windowLabel=Queries_Nav_Instance&_cuid=RC_t_888040&_pagechange=MerchantViewPolicyStatus&_pageLabel=merchantHomePage");
                  //foreach (HtmlElement el in elc)
                  //{

                  //    if (el.GetAttribute("href").Equals("https://merchant.onlinelic.in/LICMerchant/appmanager/Merchant/MerchantHome?_nfpb=true&_windowLabel=Queries_Nav_Instance&_cuid=RC_t_888040&_pagechange=MerchantViewPolicyStatus&_pageLabel=merchantHomePage"))
                  //    {
                  //        DoccumentComplete = false;
                  //        el.InvokeMember("Click");
                  //        lblMessage.Text = "Policy Status View";
                  //    }
                  //}


                  //  bool Status = WebPageValidation();
                  LoadCaptcha();


                 }




Web page code


XML
<asp:Menu runat="server" ID="Menu1" CssClass="auto-style2" BackColor="#F7F6F3" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#7C6F57" StaticSubMenuIndent="10px" style="font-size: medium" OnMenuItemClick="Menu1_MenuItemClick1">
            <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
            <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
            <DynamicMenuStyle BackColor="#F7F6F3" />
            <DynamicSelectedStyle BackColor="#5D7B9D" />
            <Items>
                <asp:MenuItem NavigateUrl="~/PolicyStatus.aspx" Text="PolicyStatus"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/LoanEligibility.aspx" Text="Loan Eligible" Value="Loan Eligible"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/SurrenderValue.aspx" Text="Surrender Value" Value="Surrender Value"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/SurrenderValue.aspx" Text="Revival Quotation" Value="Revival Quotation"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/AccuredBonus.aspx" Text="Accured Bonus" Value="Accured Bonus"></asp:MenuItem>
            </Items>
            <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
            <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
            <StaticSelectedStyle BackColor="#5D7B9D" />
        </asp:Menu>
Posted

1 solution

This is by design. By using the NavigateUrl property you are telling it to go to that link when clicked and therefore will not cause the click event to run.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menuitem.navigateurl(v=vs.110).aspx[^]
 
Share this answer
 
Comments
Kumud Dumbre 21-Jul-14 6:33am    
thank u so much RyanDev
ZurdoDev 21-Jul-14 6:54am    
No problem. You're welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900