This is a migrated thread and some comments may be shown as answers.

RadGrid GridHyperLinkColumn url data source

0 Answers 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Олег
Top achievements
Rank 1
Олег asked on 17 May 2017, 04:30 PM

Hello!

I try to create dynamic url like https://mylink.com/?parameter1={0}&parameter2={1}, but I can get only single parameter  from field DataNavigateUrlFields="myfield".

Any ideas?

After that, I tried to resolve my issue dynamically with code:

protected void OrdersRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;

                TableCell tb = item["item1"];
                HyperLink lnk = new HyperLink();
                lnk.ID = "routeId";
                lnk.Text = item["item1"].Text;
                string str1 = item["item2"].Text;
                string str2 = item["item3"].Text;
                lnk.NavigateUrl = string.Format("https://mylink.com/?parameter={0}{1}", str1, str2);
                tb.Controls.Clear();
                tb.Controls.Add(lnk);

}

}

But, I get an interesting bug: in construction item["item"].Text not all fields displays correct. In debugger, i can see in the item all the fields with their correct values. But some of them (right these I need to use!), give me '&nbsp' value. Thus, expression siring str=item["item1"].Text returns me value '&nbsp' (not in all text type fields, but only in several in the same item). May it be encoding problem? Or any other ideas?

               

 

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Олег
Top achievements
Rank 1
Share this question
or