Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7772581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:55:16+00:00 2026-06-01T16:55:16+00:00

I am using an asp.net formsview in my asp.net page and updatepanel . It

  • 0

I am using an asp.net formsview in my asp.net page and updatepanel . It has two templates Insertemplate and EditTemplate. Indie both templates there is a dropdownlist with id ddlCountry. I have a dropdownlist with all countries. I am showing states dropdown, if country is US and want to hide the row where states dropdown is shown If country is Non US. I am using following code but it is not working:

protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
    {

        Control c = (Control)sender;
        Control nc = c.NamingContainer;
        if (nc.ID == "fvBillTo" && rblShipSelect.SelectedValue == "billing")
        {
            setShippingAndTaxesDisplay();

            DropDownList ddlCountry = c as DropDownList;
            if (ddlCountry.SelectedItem != null && ddlCountry.SelectedItem.Value == "001")
            {
                HtmlGenericControl trState = nc.FindControl("trState") as HtmlGenericControl;
                trState.Visible = true;
            }
            else
            {
                HtmlGenericControl trState = nc.FindControl("trState") as HtmlGenericControl;
                trState.Visible = false; // code stops here
            }

        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:55:17+00:00Added an answer on June 1, 2026 at 4:55 pm

    The code is throwing an exception at that point because it doesn’t have a reference to the table row.

    Make sure you have the row referenced as a server side control

    <tr id="trState" runat="server"  >
    

    And cast it as a table row instead of a HtmlGenericControl

     System.Web.UI.HtmlControls.HtmlTableRow trState = nc.FindControl("trState") as System.Web.UI.HtmlControls.HtmlTableRow;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ASP.NET MVC there are situations (such as form submission) that may require a
using ASP.NET MVC 2 I have a navigation menu inside my Master Page. In
I am using ASP.net with VB.NET. Is there some Validator that I can use
I'm using asp.net 3.0. I have Page A doing a Server.Transfer to Page B.
Using Asp.Net-MVC music store tutorial, concrete page is at : http://www.asp.net/mvc/tutorials/mvc-music-store-part-3 <ul> @foreach (var
Using ASP.net, is there a recommended best way to access a particular field of
Using ASP.Net, VB.Net In my web page, i have the textbox values when i
I'm using the FormView control in ASP.NET for a simple form to insert into
Using asp.net, I need to generate a snapshot of an youtube video. I have
Using ASP.net 2.0, how do I present the information to the user similar to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.