Click here to Skip to main content
16,008,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I'm doing a Forum application in which there is a column(fm_Discription) in database. I want to display the first row data of that column in data-grid. Here my code goes...

GV_Desptn.? = dtRow[0]["fm_Discription"].ToString(); 


The question mark(?) is my doubt... Please help me out.
Posted
Updated 1-Nov-10 20:58pm
v2
Comments
syntaxed 2-Nov-10 3:05am    
So you want to display a single cell in DataGrid?
Hiren solanki 2-Nov-10 6:21am    
I think using lable is best way rather then occupying grid for just one cell. or table will be best option.
Toli Cuturicu 2-Nov-10 9:29am    
You can't use a "?" in there. It will not even compile!

GV_Desptn.Datasource= dtRow[0]["fm_Discription"].ToString();
Try it
 
Share this answer
 
v2
Comments
ks ravi 2-Nov-10 3:27am    
this is accepting(no error) but no result..
GV_Desptn.Rows[0].Cells[0].Text = dtRow[0]["fm_Discription"].ToString(); 
//Rows[0] Index of row
//Cell[0] Index of cell inside indexed row


Is it what you looking for :~

Please vote and Accept Answer if it Helped.
 
Share this answer
 
Comments
ks ravi 2-Nov-10 3:26am    
showing following ERROR;
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
GV_Desptn.Rows[0].Cells["fm_Discription"].Value = dtRow[0]["fm_Discription"].ToString(); 
 
Share this answer
 
Comments
ks ravi 2-Nov-10 3:29am    
Cells["fm_Discription"].Value, Error at this part..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900