Hello,
I have a lot of Grids that display correctly strings from a database that contains Chinese and Japanese characters as well as German and French accents. I have to build links from this items in the Grids to display the details in another page.
The URL passed to the new page has the Chinese/Japanese/etc characters: http://test.aspx?Os=Microsoft Windows 7 旗舰版
Because the way IE works I need this URL to be encoded or when I read back the Os variable it will return the value Microsoft Windows 7 ????.
I know I can accomplish this via the following Sub:
However this is kind of unpractical as the application I'm handling have around 25 different Grids where this needs to be changed, hence, even by creating a function to re-write the URL it's going to require a lot of code and the maintenance would be too cumbersome.
I was wondering if there's a way to "automatically" URL encode the GridHyperLinkColumn items in the Grid, I looked throught the documentation but I couldn't find anything relevant. I think to optionally allow this encoding for GridHyperLinkColumn would be really handy.
Thanks!
I have a lot of Grids that display correctly strings from a database that contains Chinese and Japanese characters as well as German and French accents. I have to build links from this items in the Grids to display the details in another page.
The URL passed to the new page has the Chinese/Japanese/etc characters: http://test.aspx?Os=Microsoft Windows 7 旗舰版
Because the way IE works I need this URL to be encoded or when I read back the Os variable it will return the value Microsoft Windows 7 ????.
I know I can accomplish this via the following Sub:
Protected Sub MyGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles MyGrid.ItemDataBound |
If e.Item.ItemType = GridItemType.Item Or e.Item.ItemType = GridItemType.AlternatingItem Then |
Dim dataItem As GridDataItem = CType(e.Item, GridDataItem) |
Dim currentRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView) |
For Each col As GridColumn In RadgridWinServerOSCount.Columns |
If col.UniqueName = "columnOS" Then |
Dim strTxt As String = currentRow.Row("Operating_System").ToString |
Dim NewUrl As String |
NewUrl = Server.UrlEncode(strTxt) |
CType(dataItem("columnOS").Controls(0), HyperLink).NavigateUrl = "~/test.aspx?Os=" & NewUrl |
End If |
Next |
End If |
End Sub |
However this is kind of unpractical as the application I'm handling have around 25 different Grids where this needs to be changed, hence, even by creating a function to re-write the URL it's going to require a lot of code and the maintenance would be too cumbersome.
I was wondering if there's a way to "automatically" URL encode the GridHyperLinkColumn items in the Grid, I looked throught the documentation but I couldn't find anything relevant. I think to optionally allow this encoding for GridHyperLinkColumn would be really handy.
Thanks!