Re: Sorting problem
From: Alvin Bruney [MVP] (vapor)
Date: 08/23/04
- Next message: Arda Coskun: "Re: Country of user"
- Previous message: gh0st54: "lossing data when changing page"
- In reply to: Arda Coskun: "Re: Sorting problem"
- Next in thread: Arda Coskun: "Re: Sorting problem"
- Reply: Arda Coskun: "Re: Sorting problem"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 23 Aug 2004 11:43:12 -0500
what you will need to do is either parse the xml before you load it and
change the type to int16 for the appropriate node or read in the xml as
before, create another datatable with the correct schema and shallow copy
the information to the new table
-- Regards, Alvin Bruney [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx] Got tidbits? Get it here... http://tinyurl.com/27cok "Arda Coskun" <a@a.com> wrote in message news:%23C6ZGGNiEHA.536@TK2MSFTNGP11.phx.gbl... >I did; > > DataSet oData = new DataSet(); > > oData.Tables.Add("HighScores"); > > oData.ReadXml(Server.MapPath("HighScores.xml")); > > oData.Tables[0].Columns[2].DataType = Type.GetType("System.Int16"); > > DataView oView = new DataView(oData.Tables[0]); > > oView.Sort = "Score DESC"; > > DataGrid1.DataSource = oView; > > DataGrid1.DataBind(); > > But it gives an error, you cannot change the type of column after you > created it. What can I do, thanks? > > "Arda Coskun" <a@a.com> wrote in message > news:eSXrnaBiEHA.3548@TK2MSFTNGP09.phx.gbl... >> Thanks Mr. Cheng, but how I didn't create a DataTable, how can I set that >> columns behavious as int? >> >> >> "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message >> news:i2#GMv1hEHA.2228@cpmsftngxa10.phx.gbl... >> > Hi Sarp, >> > >> > From your description, I think the sorting problem is likely caused by > the >> > DataColumns' value in the Datatable, you can have a check in the >> > certain >> > columns's DataType. Because when sorting , different data type has >> > different sorting behavior. As for the condition you met that the rows > is >> > sorted as >> > 23, 3, 44, 5 >> > >> > It is likely that the columns is sorted as "string" type rather than >> > int >> or >> > long (number type). Please have a check and try manually set the >> > DataColumns' DAtaType in the DataTable. >> > >> > Thanks. >> > >> > Regards, >> > >> > Steven Cheng >> > Microsoft Online Support >> > >> > Get Secure! www.microsoft.com/security >> > (This posting is provided "AS IS", with no warranties, and confers no >> > rights.) >> > >> > Get Preview at ASP.NET whidbey >> > http://msdn.microsoft.com/asp.net/whidbey/default.aspx >> > >> > >> >> > >
- Next message: Arda Coskun: "Re: Country of user"
- Previous message: gh0st54: "lossing data when changing page"
- In reply to: Arda Coskun: "Re: Sorting problem"
- Next in thread: Arda Coskun: "Re: Sorting problem"
- Reply: Arda Coskun: "Re: Sorting problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|