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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:33:59+00:00 2026-05-21T09:33:59+00:00

I have a DetailsView control that is not attached to a datasource, but is

  • 0

I have a DetailsView control that is not attached to a datasource, but is populated by a storedprocedure. Also, I am not defining any fields in the markup. What I’m having a problem with is grabbing cell text during the ItemUpdating event. For example, I want to grab the text from cell 1 from each of five rows and store them to a variable, but the text of the variable comes back null every time. Any help would be appreciated. Below is my markup and then the codebehind:

 <asp:DetailsView ID="goalsDetailsView" runat="server" AllowPaging="True" 
                            CssClass="mGrid" DataKeyNames="GoalID,TaskSetID" Height="50px" 
                            onitemcreated="goalsDetailsView_ItemCreated" 
                            onmodechanging="goalsDetailsView_ModeChanging" 
                            OnPageIndexChanging="goalsDetailsView_PageIndexChanging" Width="100%" 
                            onitemdeleting="goalsDetailsView_ItemDeleting" 
                            onitemupdating="goalsDetailsView_ItemUpdating">
                            <Fields>
                                <asp:CommandField ShowEditButton="True" ShowDeleteButton="True" />                                             
                            </Fields>

                        </asp:DetailsView>



protected void goalsDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        //Accessing Edited values from the Details View            

        //grab the goalid and create a string guid
        string strgoalid = goalsDetailsView.Rows[0].Cells[1].Text; //GoalID
        Guid goalid = new Guid(strgoalid);

        //grab the tasksetid and create a string guid
        string strtasksetid = goalsDetailsView.Rows[1].Cells[1].Text; //TaskSetID
        Guid tasksetid = new Guid(strtasksetid);

        //grab goal text
        //string goal = ((TextBox)GoalsGridView.Rows[3].Cells[1].Controls[0]).Text; //Company
        string goal = goalsDetailsView.Rows[2].Cells[1].Text; 

        //grab task text            
        string Task1 = goalsDetailsView.Rows[3].Cells[1].Text; //Task 1
        string Task2 = goalsDetailsView.Rows[4].Cells[1].Text; //Task 2
        string Task3 = goalsDetailsView.Rows[5].Cells[1].Text; //Task 3
        string Task4 = goalsDetailsView.Rows[6].Cells[1].Text; //Task 4
        string Task5 = goalsDetailsView.Rows[7].Cells[1].Text; //Task 5



        UpdateOrAddNewRecord(goalid, tasksetid, Task1, Task2, Task3, Task4, Task5, goal, true); // call update method            
        BindDetailsView(); // Rebind GridView to reflect changes made
    }
  • 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-05-21T09:34:00+00:00Added an answer on May 21, 2026 at 9:34 am

    I came across this in another project of mine; you want to get it from the DetailsViewUpdateEventArgs argument – this contains all the new values being submitted by the form

    string task1 = e.NewValue[3]; // etc
    

    you may want to cast the value as a string System.Convert.ToString(e.NewValue[3]); Try not to use CStr()!

    Hope this helps.

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

Sidebar

Related Questions

I have a control that look something like this: <asp:DetailsView ID=dvUsers runat=server DataSourceID=odsData DataKeyNames=Id>
I have an ObjectDataSource that I'm binding to a DetailsView control. I have the
I have a DetailsView control that I want to populate with a data table.
I have a User Control with a DetailsView that has the property AutoGenerateRows set
I have a asp.net detailsview control on a page. I've noticed that it always
This is kind of silly but I have a DetailsView that binds to a
I have DetailsView with users Info (Name, Email, Picture). That DetailsView control can be
I currently have a DetailsView in ASP.NET that gets data from the database based
Currently I have a DetailsView attached to a GridView. When you select an item
I am using a DetailsView control. Here I have both edit and delete buttons.

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.