|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataGrid sort when EditingThis 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. 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 elton_w***@hotmail.com >-----Original Message----- posts on the issue. >This may be a common question, however I didn't find any >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 Show quoteHide quote >applies when using the selecteditemindex.) > >Your help is appreciated, thank you. >. > 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. Show quoteHide quote "Steve" <St***@discussions.microsoft.com> wrote in message news:FD1EF1F4-008C-4D96-B7C1-9C66FE71B9DA@microsoft.com... > 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.
Hyperlink Format
Newbie Question on Web DataGrid Focus DataGrid Export to Excel Sorting Datagrid With Hyphen / Dash How can I format a telephone # in the datagrid email validation How to read Column0 from DataGrid Modify rows in DataTable Changing text to a textbox control in row 5 of a datagrid textbox.value |
|||||||||||||||||||||||