klimekt Posted March 20, 2008 Report Share Posted March 20, 2008 I'd like to create a field that has a hyperlink based on the data value, but I'd like the actual text of the link to say something like "Click here to view" instead of the field value. How can I override the text being displayed? Quote Link to comment Share on other sites More sharing options...
klimekt Posted March 25, 2008 Author Report Share Posted March 25, 2008 ttt Anyone? Quote Link to comment Share on other sites More sharing options...
StephenP Posted March 25, 2008 Report Share Posted March 25, 2008 Hi, Sorry about the delayed response. While a constant Text string is not available in the Column, what you are asking for is relatively easy. First, you need to create a FieldColumn in Grid.Columns. Then, you need to set the necessary properties in its Hyperlink property. The markup will resemble something like: <GridFX:FieldColumn Field="transaction_id"> <HyperLink Url="report.aspx?propertyid={property_id}" /></GridFX:FieldColumn> That will render the link in the grid, with the field data being shown. Once the link is correct, the next step will be to set the Text of the output cells to your constant. To do that, handle the Rendering event on the Grid using the Properties window in Visual Studio. In the event handler you need to do the following: protected void Grid1_Rendering(object sender, EventArgs e) { foreach (GridItem currItem in ((Grid)sender).Items) { currItem.Cells[0].Text = "Click here"; } } Note: the index in the Cells collection depends on the index of the column. In this example, it's the first one. Just adjust that and it will work fine. Hope this helps. Thanks for using Grid FX. Quote Link to comment Share on other sites More sharing options...
klimekt Posted March 25, 2008 Author Report Share Posted March 25, 2008 I was hoping to do this on the design side, but this works very well also, thanks! Quote Link to comment Share on other sites More sharing options...
StephenP Posted March 25, 2008 Report Share Posted March 25, 2008 Yeah I hear ya. We hadn't thought of this scenario. I have put it in as a suggestion, and it'll find its way into the product eventually. Thanks for using Grid FX! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.