shahab
Junior Contributor
Dear guys,
I have many Templated hyperlinks in a DataGrid,which when ever I click on one of them a QueryString like this is created :
Now I need to access to NewsId,subject value(String Value) in code behind:
I use this code :
Error:
How can I get these values in Code Behond?
I have many Templated hyperlinks in a DataGrid,which when ever I click on one of them a QueryString like this is created :
Code:
NavigateUrl='<%# "NewsDetails.aspx?NewsId="+DataBinder.Eval(Container, "DataItem.NewsId") %>' Text='<%# DataBinder.Eval(Container, "DataItem.subject") %>'>
Now I need to access to NewsId,subject value(String Value) in code behind:
I use this code :
Code:
private void Button1_Click(object sender, System.EventArgs e)
{
// Create the queryString object
SecureQueryString qs = new SecureQueryString();
// Add name/value pairs.
//qs["NewsId"] = "a"; this works well
//qs["NewsId"] = (HyperLink)e.Item.FindControl("HyperLink1").ID.ToString();
//DataBinder.Eval(Container, "DataItem.NewsId");
string HyperlinkNavigateUrl = DataBinder.Eval(Container, "DataItem.NewsId");
string HyperlinkText = DataBinder.Eval(Container, "DataItem.Subject");
// Redirect to the Destination page. We simply call the ToString() method of
// SecureQuerySting to pass the encrypted data.
Response.Redirect("NewsDetails.aspx?NewsId=" + qs.ToString());
}
Error:
Code:
'System.ComponentModel.Container' denotes a 'class' where a 'variable' was expected