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 8151467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:23:56+00:00 2026-06-06T15:23:56+00:00

I am making Gridview’s Textbox visible true or false when user changes Dropdownlists selectedIndexchange

  • 0

I am making Gridview’s Textbox visible true or false when user changes Dropdownlists selectedIndexchange event for that i have done following code

My .CS File code is as below:

protected void gvTaskList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                HiddenField hdn = (HiddenField)e.Row.FindControl("hdnStatus");
                DropDownList ddl = (DropDownList)e.Row.FindControl("ddlStatus");
                TextBox txt = (TextBox)e.Row.FindControl("txtVal");
                if (ddl != null)
                {
                    ddl.Items.Add("Not Started");
                    ddl.Items.Add("In Progress");
                    ddl.Items.Add("Complete");

                    if (hdn != null)
                    {
                        ddl.SelectedValue = hdn.Value;
                    }
                    //ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
                    ddl.Attributes.Add("onChange", "return myFun(" + "'" + txt.ClientID + "'" +");");
                }
            }
        }
        catch (Exception ex)
        {
            Utility.ErrorList("EmpTaskList--RowdataBound", ex.ToString());
        }
    }

Note: My combobox and textbox both are in EditTmplate

Javascript code is as below

<script type="text/javascript">
function myFun(txtControl) {

    var v = document.getElementById("<%=" + txtControl + "%>");
    alert(v);
}

When i m changing dropdownlist index function is called and alert is showing null.

So can anyone please suggest me what i m doing wrong??

  • 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-06T15:23:57+00:00Added an answer on June 6, 2026 at 3:23 pm

    I don’t think you want the server-side tags in your getElementById call:

    var v = document.getElementById(txtControl);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<asp:GridView ID=GridView3 runat=server Width=100% DataSourceID=SDSAllowPaging=True AutoGenerateColumns=False > <Columns> <asp:BoundField DataField=Hint HeaderText=textSortExpression=Hint /> <asp:BoundField DataField=Visi
I have a very simple mockup I'm making for a client that uses the
I am making Winforms application. I have put gridview in usercontrol. Which is another
I am making conditional formatting changes to the data in my gridview using a
I have the need to allow a user to tab through making edits on
I have the result of a linq query that's binded to a gridview. OnRowDataBound
I am making an application ASP.Net / C # where I have a Gridview
I am making an app for my class final that uses a GridView in
I have a GridView on an ASP.NET page that I'm trying to bind to
On an ASP.NET GridView, I have a field that prints a string from the

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.