. Their controls have built in callback technology. That means you don’t have to write one line of code on the client-side for ASP.Net. Anyway…
I have these panels that are hidden on my page. When you select a menu button, the panel that corresponds to the button selected is displayed and the data is updated. The problem I was having was – some of the panels have grids on them. At the time the page is rendered there is no data for the grids. So, when the page was “refreshed” the grids didn’t show the new data.
This happens because a callback will only update items that have been rendered previously. Since the grids didn’t have data in them, they were never rendered. So, I put this little chunk of code in the page_load event and it solved the issue. Essentially I’m creating a pseudo-empty dataset. I hope others will find use for this, too.
Here’s the GetDataSet function just incase you want to use it, too.
We’ll it’s been awhile, but I’m back to the ‘art’ of programming in VB.Net / ASP.Net.
Today I was trying to figure out how to set data in a GridView to uppercase. Well, not finding any help out there, I decided to forge my own path. Below is what I’ve discovered.
The first step is to create a function that converts the cells contents into uppercase...
I want to convert the data in the 9th cell (column) – remember the grid cells are zero based, so visually this is the 10th cell (column) – to uppercase
Protected Sub MyGrid_DataBound(ByVal sender As Object, _
ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
' Display the cell contents in uppercase
e.Row.Cells(9).Text = e.Row.Cells(9).Text.ToUpper
End If
End Sub
Then add an attribute to the grid’s ASP.Net configuration that calls that function when Row Data is bound to the grid.
Now, whenever a row is bound to the grid using MyGrid.DataBind(), the contents of the 9th column (cell) will be converted to uppercase.
How’s that for simplicity?