Link to home
Start Free TrialLog in
Avatar of riskyricky1972
riskyricky1972

asked on

asp.net c# binding

I have url like default.asp?statusid=1

How can I capture above querystring statusid value to the following hyperlink? statusid=request.querystring("statusid") in asp.net?

 <asp:HyperLinkField DataNavigateUrlFields="producttypeid" DataNavigateUrlFormatString="SellerAcct_ViewTransDetails.aspx?producttypeid={0}&statusid=?"
                    DataTextField="totalproductcount" HeaderText="Total Trans Count" SortExpression="totalproductcount"
                    Text=" ">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:HyperLinkField>
             
Avatar of Anurag Thakur
Anurag Thakur
Flag of India image

This article from MSDN might help you out
http://msdn2.microsoft.com/en-gb/library/aa581794.aspx
Avatar of Bob Learned
Interesting article, but I don't see how it can help here, since the value needs to come from one of the DataNavigateUrlFields.

Bob
Avatar of riskyricky1972
riskyricky1972

ASKER

Bob: You have any helps?
1) If you are bound to a DataTable, then just add a column to the DataTable, and set the column value.

2) Store the QueryString value in a Session, and retrieve from the Session variable in the target page.

Bob
I am in for item 1. Please show me actual code in c#. thank you
DataTable dt = this.DataSet1.Tables[0];
dt.Columns.Add("StatusID", typeof(int));

int statusID = (int)Request.QueryString["StatusID"];
foreach (DataRow dr in dt.Rows)
    dr["StatusID"] = statusID;

dt.AcceptChanges();

Bob
Is that a way I can use inline coding?
No, since StatusID would need to be taken from a field value.

Bob
I used inline datagrid from above hyperlink. And I do not see anything that I can use your codes.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial