Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: datagrid sort, primary key


Message #1 by "Senthil Malathi" <senthil.malathi@a...> on Sat, 16 Dec 2000 15:02:46 +0400
This is a multi-part message in MIME format.



------=_NextPart_000_01D3_01C06771.3FAEA770

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: 7bit



I get an error when I sort data in datagrid by clicking on the col name.  I

use Oracle as backend.



Line :0

Error : Object expected.



although



OnSortCommand="MyDataGrid_Sort" AllowSorting="true"



properties are set for the data grid.



Protected Sub MyDataGrid_Sort(Src As Object, E As

DataGridSortCommandEventArgs)

      BindGrid(E.SortField)

End Sub



However sort cmd works in page load



Sub Page_Load(Src As Object, E As EventArgs)

    BindGrid("MySortCol")

End Sub



Any help?



Also, if my primary key is composite, how do I specify DataKeyField prop of

datagrid?

SNo,EntryDate together forms the primary key of my table.





Thanks & Regards,

S.Malathi

____________________________________

ADNOC Distribution, IT Division

P.O. 4188, Abu Dhabi, U.A.E.

Tel : +xxx x xxxxxxx

Fax: +xxx x xxxxxxx

Mobile : 050 5316055







---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to aspx as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com








Message #2 by Susan Warren <swarren@m...> on Sun, 17 Dec 2000 06:26:08 -0800
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C06835.4C27C7FE

Content-Type: text/plain;

	charset="iso-8859-1"



Senthil, 

 

SortField is set on a per-column basis: SortField="some string".  If the

columns are generated automatically, the string passed in SortField will be

field name from the datasource.  This works fine for me but without seeing

more of your code, it's hard to tell why it doesn't work for you.  

 

Re DataKeys this is a field name from the datasource, so this will hold the

contents of exactly one field only.  To store a combination key, create a

calculated field in the data source that already a combination of the two

keys.  Since I'm not a data expert I don't know how to do this in Oracle,

but in a SQL sproc I'd do something like this:

 

    SELECT (au_fname + ';' + au_lname) As UserName 



Go can then set your DataKeyField to this calculated field.  

 

hth,

Susan



-----Original Message-----

From: Senthil Malathi [mailto:senthil.malathi@a...]

Sent: Saturday, December 16, 2000 3:03 AM

To: ASP+

Cc: aspxWrox

Subject: [aspx] datagrid sort, primary key





I get an error when I sort data in datagrid by clicking on the col name.  I

use Oracle as backend.

 

Line :0

Error : Object expected.

 

although

 

OnSortCommand="MyDataGrid_Sort" AllowSorting="true" 

 

properties are set for the data grid.

 

Protected Sub MyDataGrid_Sort(Src As Object, E As

DataGridSortCommandEventArgs)

      BindGrid(E.SortField)

End Sub

 

However sort cmd works in page load

 

Sub Page_Load(Src As Object, E As EventArgs)

    BindGrid("MySortCol")

End Sub

 

Any help?

 

Also, if my primary key is composite, how do I specify DataKeyField prop of

datagrid?

SNo,EntryDate together forms the primary key of my table.

 

 

Thanks & Regards,

S.Malathi

____________________________________

ADNOC Distribution, IT Division

P.O. 4188, Abu Dhabi, U.A.E.

Tel : +xxx x xxxxxxx

Fax: +xxx x xxxxxxx

Mobile : 050 5316055

 

---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.



To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com









---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.

---

You are currently subscribed to aspx as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com







  Return to Index