I was trying to pass two values. My previous login page I passed ID to Patient.aspx and queried an Access DB. On this page I use user=Request.QueryString("ID") in the Page_Load sub to get the valued passed.
To direct to record.aspx I need to pass user and PatientID inorder to get the correct info from the DB.
<asp:HyperLinkColumn
Text="ok"
DataNavigateUrlField="Patient"
DataNavigateUrlFormatString="Record.aspx?UserID="&<%user%>&"&PatientID={0}"
/>
This doesn't work but when I hard code UserID with 1 then it works.
<asp:HyperLinkColumn
Text="ok"
DataNavigateUrlField="Patient"
DataNavigateUrlFormatString="Record.aspx?UserID=1&PatientID={0}"
/>
How can I pass user to DataNavigateUrlFormatString?
If there is a better way I'm open for suggestions.
Thank You
Passing values in Datagrid
Page 1 of 13 Replies - 7242 Views - Last Post: 24 July 2006 - 01:34 PM
Replies To: Passing values in Datagrid
#2
Re: Passing values in Datagrid
Posted 24 July 2006 - 11:02 AM
Try
or
DataNavigateUrlFormatString="Record.aspx?UserID="&<%=user%>&"&PatientID={0}"
or
DataNavigateUrlFormatString="Record.aspx?UserID="<%=user%>"&PatientID={0}"
#3
Re: Passing values in Datagrid
Posted 24 July 2006 - 12:05 PM
Thanks for the response. Unfortunatlly neither worked. This is the error I get.
Literal content ('" DataNavigateUrlField="Patient" DataNavigateUrlFormatString="Record.aspx?UserID="') is not allowed within a 'System.Web.UI.WebControls.HyperLinkColumn'.
I tried <%redirect.write(user)%> outside the datgrid and the value printed correctly.
In the error it wont pick up the value of user.
Any suggestions.
Thanks
Literal content ('" DataNavigateUrlField="Patient" DataNavigateUrlFormatString="Record.aspx?UserID="') is not allowed within a 'System.Web.UI.WebControls.HyperLinkColumn'.
I tried <%redirect.write(user)%> outside the datgrid and the value printed correctly.
In the error it wont pick up the value of user.
Any suggestions.
Thanks
#4
Re: Passing values in Datagrid
Posted 24 July 2006 - 01:34 PM
I changed the way I'm passing values. Here is the code that works. Thanks for your reply.
Sub DataRecords(s As Object, e As CommandEventArgs)
Dim strID as String
Dim patient as string
user=Request.QueryString("ID")
patient = e.CommandArgument.ToString()
Response.Redirect("Record.aspx?UserID="& user &"&PatientID=" & patient)
End Sub
<asp:templatecolumn>
<ItemTemplate>
<asp:imagebutton id="btnRecord" ImageUrl="view2.gif" Runat="Server"
OnCommand="DataRecords"
CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Patient") %>' TEXT="Record" />
</ItemTemplate>
</ASP:templatecolumn>
Sub DataRecords(s As Object, e As CommandEventArgs)
Dim strID as String
Dim patient as string
user=Request.QueryString("ID")
patient = e.CommandArgument.ToString()
Response.Redirect("Record.aspx?UserID="& user &"&PatientID=" & patient)
End Sub
<asp:templatecolumn>
<ItemTemplate>
<asp:imagebutton id="btnRecord" ImageUrl="view2.gif" Runat="Server"
OnCommand="DataRecords"
CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Patient") %>' TEXT="Record" />
</ItemTemplate>
</ASP:templatecolumn>
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|