Connecting Tech Pros Worldwide Forums | Help | Site Map

Newvalues in a gridview

Newbie
 
Join Date: May 2007
Posts: 17
#1: Nov 11 '08
Hi Gurus

I have created a small application to load data into a gridview from a dataset. Now I want to update the data set but when I try to use the keys() and the newvalues() arrays they all do not contain any data. I am biding the gridview in code. How do I enable my gridview to populate the keys() and the newvalues collections in a gridview that i set properties programmatically. I am using vb.net

Newbie
 
Join Date: Nov 2007
Posts: 18
#2: Nov 11 '08

re: Newvalues in a gridview


Can you put the sample code?
Newbie
 
Join Date: May 2007
Posts: 17
#3: Nov 11 '08

re: Newvalues in a gridview


Quote:

Originally Posted by Murugs

Can you put the sample code?

After filligng my datest called dsenrol I have the following code.

Expand|Select|Wrap|Line Numbers
  1. GridView1.DataSource = DsEnrol
  2.             GridView1.AutoGenerateColumns = "False"
  3.             GridView1.DataKeyNames = New String() {"Institution_id", "Year_id", "field1"}
  4.             GridView1.DataBind()
I have edited the grid colums and specified the fields I want to show in the grid.
Newbie
 
Join Date: Nov 2007
Posts: 18
#4: Nov 11 '08

re: Newvalues in a gridview


Hi,
//GridView1.DataKeyNames = New String() {"Institution_id", "Year_id", "field1"}
what exactly u r trying to do in this line.
Is all the three columns are primary columns?
r u using the below code to get datakey values?
//Gridview1.DataKeys
can you post all the code so that we can sense the exact error?

Thanks,
Murugs.
Reply