Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GRidview question 2

Status
Not open for further replies.

rqmedes

Programmer
Jun 22, 2002
6
AU
HI All

I was hoping someone could point me in the right direction

I have created a gridview and i want to extend the

OnRowDataBound Method, i want to be able to get a list in this method of all the BoundField DataField's names that i have assigned in the grid.

I can get the values returned from SQL but not the names

eg

protected override void OnRowDataBound(GridViewRowEventArgs e)

{

DataRowView tableData = e.Row.DataItem as DataRowView;

tableData[Name].ToString()



this will give me the value of the row, but how do i get a list of all DataFields

eg ....,Name,....



Regards
 
rgmedes: Not a C# programmer but I came across this bit of code:
Code:
foreach (System.Data.DataColumn col in cPay.DataView.Table.Columns)
{
        Console.WriteLine(col.ColumnName);

}

You might try some variation thereof.
 
rgmedes: ca8msm has some related code in a thread just below this one (thread855-1199052). There are few references to a DataView's Column name and might be enough information for you in this thread to get you over the hump.
 
HI Isadore

Thanks very much for the quick reply, i am also not a C# programmer and have just started.

I appreciate your suggestions, ( I am sure you have pointed me in the right direction)

Once again thanks again i posted 3 different questions on the asp.net forum pages and have had no response to any several days later but at tek-tips i have found a very helpful community,
I am not profecient enough to assist others yet but will contribute to tek-tips when i can

Thanks Again

 
rgmedes: Thanks alot for the star - you would be amazed at the level of help these guys give out here - very much the 'academic' spirit. I am only learned at the technical level but can chime in from time to time to help -- stick around; these guys are very good; you can learn a lot here by dropping by. Of course the same applies to other forums here at Tek-tips (you'd be amazed, for example, how quickly the gurus over at the Javascript forum jump on an issue) -- the only requirement I think is just keep it honest, do a little research and be prepared -- don't make yourself a stranger.
 
I am not profecient enough to assist others yet but will contribute to tek-tips when i can
That's the spirit! You'll find that you probably have a lot more to offer than you think and by simply asking questions and reading the answers, you'll pick up lots of knowledge that can hopefully help someone else in future.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top