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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:55:50+00:00 2026-06-13T06:55:50+00:00

I am just want to check for empty text boxes and change the text

  • 0

I am just want to check for empty text boxes and change the text the boxes if they are null in RowEditing event. I just can’t figure this out. Of course the some of the boxes will be empty when the Grid is populated. The other question is am I placing this in the right event?

Here is the row editing event :

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{        
    fill_grid();

    //Set the edit index.
    GridView1.EditIndex = e.NewEditIndex;
    //Bind data to the GridView control.
    check_grid_boxes();
    GridView1.DataBind();
}

Here is the check_grid_boxes Method :

protected void check_grid_boxes()
{
    if (gtxtLane.Text == "")
    {
        gtxtLane.Text = "0";
    }
    else if (gtxtCarriers.Text == "")
    {
        gtxtCarriers.Text = "0";
    }
    else if (gtxtREV.Text == "")
    { 
        gtxtREV.Text = "0";
    }
    return;
}

Before you mention Java Script or Jquery. This is a web control and my attempts at using java has not worked.

I changed my code to this :

  protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            fill_grid();
            GridView1.EditIndex = e.NewEditIndex;

            var lane = (TextBox)GridView1.Rows[e.NewEditIndex].FindControl("gtxtLane");
            var car = (TextBox)GridView1.Rows[e.NewEditIndex].FindControl("gtxtCarriers");
            var badcar = (TextBox)GridView1.Rows[e.NewEditIndex].FindControl("gtxtBadCarriers");

            if (String.IsNullOrEmpty(lane.Text))
            {
                lane.Text = "0";
            }
            else if (String.IsNullOrEmpty(badcar.Text))
            {
                badcar.Text = "0";
            }
            else if (String.IsNullOrEmpty(car.Text))
            {
                car.Text = "0";
            }
               GridView1.DataBind();
         }
  • 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-13T06:55:54+00:00Added an answer on June 13, 2026 at 6:55 am

    DUH!!!! how bout –> select isnull(lane,’0′) as Lane <—. I can’t believe I didn’t think of that!! 6 hours wasted!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I just want to check if one time period overlaps with another. Null
I want to check that session is null or empty i.e. some thing like
I just want to check if I understood well the way asynchronous Http request
I just want to check if there is any easy way to limit zooming.
I just want to check whether the facebook user is atleast on facebook for
I just want to check and see if a row exists where the $lectureName
Before Entering data into a database, I just want to check that the database
Possible Duplicate: check whether internet connection is available with C# I just want to
I want to check if a checkbox just got unchecked, when a user clicks
Just want to ask if i can use Custom Validator in client side without

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.