Hi,
I have a data like this :
and I want it to be like this :
Is there anyway to add numbering after the sorting?
Hi,
I have a data like this :
and I want it to be like this :
Is there anyway to add numbering after the sorting?
hey,
you can use this
datatablevariable = From x In datatablevariable.AsEnumerable() Order By convert.Tostring(x(“Branch”)),convert.ToString(x(“No”)) Select x).CopyDataTable
Thanks,
Rounak
Thanks, it works !
HI,
Is your requirement re-assign “No” column in order? If so, the following will work.
dt = dt.AsEnumerable.OrderBy(Function(r) r("Branch").ToString).Select(Function(r,i) dt.Clone.LoadDataRow({(i+1).ToString,r("Name").ToString,r("Branch").ToString},False)).CopyToDataTable
Regards,
This one works too. Thanks
I do not think this is you expected. You need to re arrange the No 1…n after sort by branch.
This is correct
Well I did modify it a little bit matching with my current code and it works so basically I tried to learn the logic. But both from Mr. Yoichi and Mr. Rounak are both solutions
Thanks for discussing btw
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.