Hi,

I would like to know if there is a way to rename a label which is inside a GridView during the runtime. What I'm trying to do is: if the user chooses an option, Label.Text will be "Option 1"; if he chooses the other option, Label.Text = "Option2". Is this possible?

Thanks!

Recommended Answers

All 4 Replies

Upload a sample project demonstrating the condition on what you want to change

Hi Ana D.,
Please show your code first.

Use FindControl method of GridView to have a reference of Label control.

DataGridView control have 2 collections
One is Columns and the other is Rows.
Rows collection contains Cells collection to represent each cell

If you want to access one cell in the grid, you have to know which row and which column you want.

DataGridView1.Rows(1).Cells(2).Value

This access the value of cell in row index 1 (index start from 0) and column (2)

I hope this small code can help you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.