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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:11:57+00:00 2026-06-08T12:11:57+00:00

I am using edit template in my gridview to update some control values like

  • 0

I am using edit template in my gridview to update some control values like dropdowns, textboxes etc.I am finding these control on update function as follows :

string dd1 = ((DropDownList)OwnerGrid.Rows[e.RowIndex].FindControl("ddl1")).SelectedItem.Text.Trim();

string actual = ((TextBox)OwnerGrid.Rows[e.RowIndex].FindControl("txtowneractual")).Text.Trim();

I have bound dropdowns from which i am selecting items before updating. I am also filling textboxes before updating. The textboxes are not binded.

When I am clicking on update, it is throwing “Object reference not set to instance of an object” error. I have debugged the code, textbox value is null while I am getting dropdown value.

What is the issue ?

Designer for textbox :

<asp:TemplateField HeaderText = "Actual" >

<EditItemTemplate>
                <asp:TextBox ID="txtowneractual" Width="80px" runat="server" ></asp:TextBox>                  

</EditItemTemplate>
<ItemTemplate>               

</ItemTemplate>
</asp:TemplateField>
  • 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-08T12:11:59+00:00Added an answer on June 8, 2026 at 12:11 pm

    I think your textbox is in Edit Item template due to which you are getting a null reference exception. try some thing like this

    if (e.Row.RowState == DataControlRowState.Edit )
     {
    string actual = ((TextBox)OwnerGrid.Rows[e.RowIndex].FindControl("txtowneractual")).Text.Trim();
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a user control in some edit item template (telerik radgrid). But, my
using a windows EDIT control with ES_NUMBER style and with an accompanying UPDOWN control,
I'm using the Scintilla edit control on Windows (Win32, C/C++) . The control is
In my app, I am using NSFileHandle to edit some file but it is
I'm using Fancybox and Zend. Hope the following is clear. On www.example.com/template/edit/id/3 I have
I am using a GridView within an updatepanel. I have gridview generated edit and
I have a RadGrid control with template edit form implementation. I need to have
In the GridView we are using an edit button. Once the edit button is
I would like to show different values in a dropdownlist, while editing a gridview,
I'm using the row edit template below. The problem I have is that 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.