Start New Discussion Reply to this Discussion DataList
Is it possible to set two DataKeyField in DataList...........
If yes then pls help me out...................
crazydevelopervish
Light Poster
26 posts since Jul 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0
Try like this:
myDataList.DataKeyFields = "myCol1,myCol2";
AleMonteiro
Master Poster
752 posts since Aug 2010
Reputation Points: 129
Solved Threads: 140
Skill Endorsements: 23
and then how can i retrive value from it.....
general code is as follows...
DataList1.DataKeyField = "Customer_ID,Product_ID";
String Product_ID = DataList1.DataKeys[e.Item.ItemIndex].ToString();
String Customer_ID = DataList1.DataKeys[e.Item.ItemIndex].ToString();
crazydevelopervish
Light Poster
26 posts since Jul 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0
Maybe like this:
string keys[] = DataList1.DataKeys[e.Item.ItemIndex].ToString().split(',');
string productId = keys[0];
string customerId = keys[1];
AleMonteiro
Master Poster
752 posts since Aug 2010
Reputation Points: 129
Solved Threads: 140
Skill Endorsements: 23
not working geting error after including
string keys fixed[]=DataList1.DataKeys[e.Item.ItemIndex].ToString().Split(',');
Error 559 The type of a local declared in a fixed statement must be a pointer type
crazydevelopervish
Light Poster
26 posts since Jul 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0
What does DataList1.DataKeys[e.Item.ItemIndex] returns?
Debug and see what's the value.
AleMonteiro
Master Poster
752 posts since Aug 2010
Reputation Points: 129
Solved Threads: 140
Skill Endorsements: 23
it returns only Customer_ID
crazydevelopervish
Light Poster
26 posts since Jul 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0
AleMonteiro
Master Poster
752 posts since Aug 2010
Reputation Points: 129
Solved Threads: 140
Skill Endorsements: 23
© 2013 DaniWeb® LLC
Page rendered in 0.0757 seconds
using 2.7MB