.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Select updated record after edit

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :ASP.Net
Hello!On one (aspx) page I have a GridView (GridView has multiple pages). After a user selects a row/record and clicks "edit" he's redirected to another (.aspx) page where he edits the selected record via DetailsView. After clicking update on DetailsView he's redirected back to the page containing the GridView.What is the simplest/shortest way that the updated record is automatically selected on the Gridview (e.g. at Page_Load event)?Thx in advance!M

View Complete Post

More Related Resource Links

Gridview Edit on Searching of Record


using Asp.net c#

sql server

i am searching a record from my database and displaying it in gridview now i want the comments should be updated as per the record which is being searched

For E.g if record No.3 is searched then only i can update record no.3 and i don't want rest of data to be shown

now what is happening when i click on edit my whole table is being displayed

this is bcuz i made one method gridfill() which i m calling everytime if i m doing grid row editing,row cancelling and row updating

how i can resolve this thing

my code

 protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)
        GridView2.EditIndex = e.NewEditIndex;


 protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
        string id = GridView2.Rows[e.RowIndex].Cells[0].Text;
        TextBox t;
        t = (TextBox)GridView2.Rows[e.RowIndex].Cells[2].Controls[0];
        string query = "update user1 set comments=@comments where id=@id";
        SqlConnection con = new SqlConnection(connstr);
        SqlCommand cmd = new SqlCommand(query, con);

Edit gridview record on 2 rows



Is that possible to edit a record within a gridview on 2 rows to make it look better when editing?

Like I have 8 columns in my gridview.

I wish to have 4 columns on row one and the 4 remaining columns on row 2.


select max record to join another table sybase

select a.pono,(select (user) from user where userid=a.userid having date=max(date)) as user from a inner join b on a.no=b.no  in the result , i have selected the same id and retrieve two records every thing are same except the date how can i select the record out of two record which date is max date as the where Clasuse to select correct user poid    date                name 1        12/08/2010      Mary 1        20/08/2010      Peter   now i would like to select name which id=1 and date is max and then use the name to join another table because name is foreign key  

Problem Select ancestors a Record

Hi; I have a table by three columns ("ID","Title","ParentID"),me want to select ancestors a Record by "ID" identifier. example: ID      Title       ParentID 1         Library       null 2         Section1      1 3        Section2       1 4        1.1              2   for example if record 4 selected return records by "ID" identifier 2,1 How can me do it?  

simple form for single record edit

I've been asked to create a web form to edit a couple of fields in one record in an Access database. The database is on the same server as the website. This is part of a simple CMS that someone developed a long time ago in traditional ASP with VB. I don't know VB well and am trying to get something working by adapting the existing code used in the CMS. I can get the form to display the current values in the record (there are only two fields that need to be edited), but I can't get the form to successfully update the record when the user clicks the submit button. I'm sure the solution  is simple but I've googled up down and sideways and can't seem to get this to work. If anybody with a little patience has a minute to look at this and offer a solution, I'd be grateful. Here's a link to the page in questsion: http://www.penobscotbayinn.com/admin/AdminFrameDefault.asp (click on "edit rates page text") on the  menu. If you submit the form you get a HTTP500 error. Thanks for your time. This seems like it must be a dirt simple procedure, but I'm not very conversant in VB.Here's the code: 1. <%@ Language=VBScript %> 2. <% option Explicit %> 3. <% 'Response.Buffer = true %> 4. <!--#include file="../adovbs.inc"--> 5. <!--#include fi

select the record with the lowest datediff()

Hello, I am trying to figure this out and can't quite get it. I have a subselect in my select that can of course only return one row. In some cases it will return more than one, to filter out the other rows we are going to only return the row with the least amount of days between 2 dates. I got it work as shown below but I hope that there is a better way to do this. select CreatedDate, ConfirmedDlv, inventtransid, min(DATEDIFF(DAY,CreatedDate, ConfirmedDlv)) from SalesLine where projId = '005124' and ItemId = '105732' and dataareaid = 'dfg' group by CreatedDate, ConfirmedDlv, inventtransid having min(DATEDIFF(DAY,CreatedDate, ConfirmedDlv)) = ( select min(DATEDIFF(DAY,CreatedDate, ConfirmedDlv)) from SalesLine where projId = '005124' and ItemId = '105732' and dataareaid = 'dfg' ) Anyone have any tips?   Thanks

How to select bottom record if there is no id in table.

Hi All, I am trying to select the bottom record but there is no id in table. For Example A              B jo             john so             som mo            mon to              tom go              gone

DetailsView error "must be in edit mode to update a record" when I have set edit mode in code behind

Hi,I have a DetailsView within an UpdatePanel.  I programmatically put the DetailsView into edit mode, change the fields then call the UpdateItem method which causes the "must be in edit mode to update a record" exception.  Am I missing something blindingly obvious? <asp:UpdatePanel ID="upSpecificShout" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" > <ContentTemplate> <asp:DetailsView ID="dvSingleShout" DataSourceID="sdsSingleShout" runat="server" AutoGenerateRows="false" OnDataBound="SetDVIcons" HeaderStyle-CssClass="noDisplay" DefaultMode="ReadOnly" AutoGenerateEditButton="true" OnItemCommand="dvItemCommand"> <fields> <asp:TemplateField ShowHeader="false"> <ItemTemplate> <asp:Panel ID="dlSpecificDetailsViewPanel" runat="server" CssClass="i_am_a_shout"> <h2><asp:LinkButton ID="lblShoutTitle" runat="server" Text='<%# Bind("Shout_Title") %>' On

This task could not be updated at this time on clicking Edit Task in Outlook 2007



I wonder if someone can help me please.  We have a Workflow that creates a task and sends an e-mail notification to the approver. The Approver receives an e-mail and the Edit task form pops up with the correct information.

When the approver clicks Edit Task we get "This task could not be updated at time time" error when approver clicks submit button.

Upon searching the forum I found this article http://support.microsoft.com/kb/970199  however as the user doesn't have infopath 2007 (only has basic Office 2007) we cannot install the Forms Installer Tool.

Is there any way around this such as turning off the need for Inf

How to select a master record plus related custom fields in the same row?


Consider this table of master records:

project_id  project_name

1               Important Project

2               More Important Project


My application allows users to create an arbitrary number of custom fields for projects. Here is the table of custom field values:

custom_field_value_id   project_id   custom_field_name   custom_field_value

1                                  1               Project Manager        Jim Smith

2                                  1               Due Date                  12-31-2010

3       &

select record based on / match selected date

with the sql statement below, i try to select the records based on the selected date, it return no rows from adapter filled datatable. 
however, when i run the query in sql query in sql server studio management, it returns records. 
date format = 09/28/2010

string[] splitDT = txtSelectedDate.Text.Split('/');

            string strRearrangeDT = splitDT[0] + "/" + splitDT[1] + "/" + splitDT[2];

using (SqlConnection sqlconn = new SqlConnection(connstring))
                DataTable dt = new DataTable();
                string strSQL = "SELECT userclaim_details3.id, userclaim_details3.userclaimid, userclaim_details3.userid, userclaim_details3.childcategorytableid, userclaim_details3.statusid, " +
                         "userclaim_details3.amount AS amountname, userclaim_details3.remark AS remarkname, userclaim_details3.datecreated AS datecreatedname, " +
                         "userclaim_details3.datemodified, approvaltable.id AS Expr1, approvaltable.typename AS statusname, usertable2.id AS Expr2, usertable2.name AS uname, " +
                         "childcategorytable.id AS Expr3, childcategorytable.categor

Opening in Read-Only after you select Edit


This issue is growing rampantly with our organization.  Users opening SharePoint documents (Word or Excel, etc.) and they select Edit but it opens as Read-Only.  We have tried a variety of things, but what solves the issue is to recreate the users profile.  We can't keep doing this.

Things we've tried prior to recreating the users profile have been:

  • Reinstall webfolders.msi located at C:\Windows\System32
  • Update OWSUPP.DLL located at C:\Program Files\Microsoft Office\Office12
  • Clear Temporary Internet Files.
  • Make sure the sharepoint URL is not in trusted sites.

Any assistance with this issue is greatly appreciated.


how to select the record when their is no record on the other table


Hi all,

 i am working on migration project  i have to select the record from one table which is not prescent in other depending on the condition

for example i have two table one is master table & other is transaction Table 

structure of master table is as follows

Sb_Type      Sb_acno            name                 Id -------------------------------------

 N              na/0005               aaa                   12 -------------------------------

M               Mb/0002              bbb                   15 -------------------------------------

--                  ----                   --     &nbs

select record where field = variable?


Hi, I'm very new to SQL so please excuse how simple this problem is:

I've got a web page which contains a form, the form holds the following boxes:

  • Latitude
  • Longitude
  • Accuracy
  • Update
  • UserName

I have also got an access database , containing one table (Table1) which has the fields:

  • Latitude
  • Longitude
  • Accuracy
  • Update
  • UserName

The "UserName" field is the primary key (containing an email address)

What I want to do is select the record that has the same email address as entered into the form and update the rest of the fields with the data entered into the form.

The problem I'm having, as I see it, is that I can't seem to compare a string to a record UserName?

When I enter the email address manually it works and updates the record but it won't pull the email address from the variable string?

Here is my .asp code:


'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim email 'Holds the current users email address

email = (Request.Form("UserName"))

Set dbConn = Server.CreateObject(

What is the code to say if the select statement of sqldatasource1 control has no record, then..


What is the code to say:-

 if the select statement of sqldatasource1 control has no record, then..

Pls help... thanks




modifying the last record of a fiitered SELECT



I have a SQL data source control defined to filter data from a SQL database, sorted according to the date time in descending order. When i try and update a field of the  latest record, the entire column, related to the field of the filtered search gets modified. I want to only update a field of the last record i.e. the last entry of the filtered data. How can i achieve it?

Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend