Hi
In amazonLink it is showing Url but value in below line is NULL
HyperLink lnkAmazonLink = (HyperLink)e.Row.FindControl("AmazonURL");
In Table Header it is shown like this
BookId Book ComboBookName CoreRPL Lexile NumberOfPages SessionPlanStatus ClosingStock AmazonURL Hritvi Srini Remarks
string amazonLink = DataBinder.Eval(e.Row.DataItem, "AmazonURL").ToString().Trim();
if (amazonLink != null)
{
HyperLink lnkAmazonLink = (HyperLink)e.Row.FindControl("AmazonURL");
//lnkAmazonLink.Text = "Amazon Link";
//lnkAmazonLink.NavigateUrl = amazonLink;
//lnkAmazonLink.Target = "_blank";
////////lnkAmazonLink.CssClass = "amazon-link";
}
Thanks
Riddhi ValechaPosted May 23, 2023, 8:18 PM
Hi..
Could you share the code in zip file please ?
It will be easy for us to debug.
Tuhin PaulPosted May 21, 2023, 4:16 PM
Part 2
Here is an example of how to add the AmazonURL column to the SELECT statement and refresh the data in the GridView:
Tuhin PaulPosted May 21, 2023, 4:16 PM
Part 1
The reason why the value of the AmazonURL control is NULL is because the AmazonURL column is not being populated in the data source. To fix this, you need to make sure that the AmazonURL column is being populated in the data source. You can do this by adding the AmazonURL column to the SELECT statement that is used to populate the data source.
Once you have added the AmazonURL column to the SELECT statement, you need to refresh the data in the GridView. You can do this by calling the GridView.DataBind() method.
Once you have refreshed the data in the GridView, the value of the AmazonURL control should no longer be NULL.
Mohamed Azarudeen ZPosted May 21, 2023, 12:02 PM
Hi Ramco
Can you try these troubleshootings
Ensure that the field "AmazonURL" is present in the data source that is bound to the GridView.
Debug and inspect the data source and check if the "AmazonURL" field has a value for the corresponding row.
Verify that the field name is correct and there are no spelling or case sensitivity issues.
If the issue persists and the "AmazonURL" value is indeed NULL or not being retrieved correctly from the data source, you should investigate the data binding process, such as how the GridView is populated and how the data source is assigned.
Additionally, please note that in the code snippet, you have commented out the lines that set the properties of the HyperLink control (
lnkAmazonLink.Text,lnkAmazonLink.NavigateUrl,lnkAmazonLink.Target). Make sure to uncomment and modify these lines appropriately once the issue with retrieving the "AmazonURL" value is resolved.