Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > DataGrid sort when Editing

Reply
Thread Tools

DataGrid sort when Editing

 
 
Steve
Guest
Posts: n/a
 
      03-09-2005
This may be a common question, however I didn't find any posts on the issue.
When you are editing a row of a datagrid, and then you sort the datagrid, the
edititemindex stays the same, which means that you are now editing a
different item (though the same physical row of the datagrid). How can you
make it so that you are still editing the same data after you sort? As it
is, I am simply clearing the edititemindex. (By the way, this issue also
applies when using the selecteditemindex.)

Your help is appreciated, thank you.
 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      03-09-2005
Hi Steve,

I suppose you have to implement your own code to solve the
problem. You may use following logic.

When sorting
If edititemindex <> -1 then
Find PK data from edit item
Endif
Sort data source and assign it to datagrid
Find index from PK data
Assign edititemindex = the index
Call datagrid.DataBind


HTH

Elton Wang
http://www.velocityreviews.com/forums/(E-Mail Removed)

>-----Original Message-----
>This may be a common question, however I didn't find any

posts on the issue.
>When you are editing a row of a datagrid, and then you

sort the datagrid, the
>edititemindex stays the same, which means that you are

now editing a
>different item (though the same physical row of the

datagrid). How can you
>make it so that you are still editing the same data after

you sort? As it
>is, I am simply clearing the edititemindex. (By the way,

this issue also
>applies when using the selecteditemindex.)
>
>Your help is appreciated, thank you.
>.
>

 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      03-13-2005
You'll have to know the index of the row in the dataset. Unfortunately, the
DataSetIndex property doesn't provide this accurately after you have sorted,
so you'll need to find the record manually in the dataset and then get its'
index. You can use the Select method and pass a SQL like search criteria to
help you find the record in the DataSet.


"Steve" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This may be a common question, however I didn't find any posts on the
> issue.
> When you are editing a row of a datagrid, and then you sort the datagrid,
> the
> edititemindex stays the same, which means that you are now editing a
> different item (though the same physical row of the datagrid). How can
> you
> make it so that you are still editing the same data after you sort? As it
> is, I am simply clearing the edititemindex. (By the way, this issue also
> applies when using the selecteditemindex.)
>
> Your help is appreciated, thank you.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are you looking for high quality photo editing and video editing? gwanglu@gmail.com C Programming 0 07-19-2006 12:32 PM
Re: When will Thunderbird support sort in place (in context sort)? Ron Natalie Firefox 0 02-02-2006 04:38 AM
DataGrid. How to keep the right keyfield value when Sort the DataGrid? Eugene ASP .Net 0 09-28-2004 05:15 PM
Editing a datagrid nested within another datagrid uk00121 ASP .Net Datagrid Control 2 04-19-2004 02:17 PM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM



Advertisments