Showing posts with label hyperlinkcolumn. Show all posts
Showing posts with label hyperlinkcolumn. Show all posts

Thursday, March 29, 2012

Passing values from a datagrid w/ a HyperLinkColumn

I have successfully populated my datagrid. It consists of only one column. THis column is a link. What I am trying to do is send the text of the link (also what is pulled from the DB) to the aspx page that the link submits to.

I'm open to all suggestions as I'm new and trying to learn all different ways possible.

Thanks!

HDYour column should look like this :


<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="DepartmentID" DataNavigateUrlFormatString="default.aspx?DepartmentID={0}"
DataTextField="DepartmentName" HeaderText="Departments :" ItemStyle-CssClass="side "></asp:HyperLinkColumn>
</Columns>

The DataNavigateUrl field gets placed where the {0} is in the DataNavigateUrlFormatString. DataText is the displayed link text.

On the next page you can pick up the value using Request.Params("DepartmentID")

Simon
Great thanks. However I am receiving the following where I try to do the Request.Params("fieldName").


"'System.Web.HttpRequest.Params' denotes a 'property' where a 'method' was expected"

The line of code throwing the error is :


TextBox1.Text = Request.Params("SelectedCategory");

Thanks for your help, and forgive the stupid questions.

HD
Nevermind. I figured it out. I changed the line of code to

Request.Params.Get("SelectedCategory")

HD

Wednesday, March 21, 2012

Passing variables in query string in the HyperLinkColumn of a datagrid

Hi All,
I have to pass variable in a query string.
The query string is in the hyperlink coloumn of a datgrid.
The code appears like this
<asp:HyperLinkColumn DataNavigateUrlField="ProductID"
DataNavigateUrlFormatString="ViewProduct.aspx?qProductID='<%strProduct%>'"
DataTextField="ProductID" HeaderText="Product ID">
<HeaderStyle Width="10%"></HeaderStyle>
</asp:HyperLinkColumn>
this does not work..
Can any one help..Where is <%strProduct%>' coming from. Is this a column in your datasource.
If so then you need to sue the binding synthax '<%# strProduct%>'
TDAVISJR
aka - Tampa.NET Koder
<aparnasinha26@.yahoo.com> wrote in message
news:1116325678.716477.36020@.z14g2000cwz.googlegroups.com...
> Hi All,
> I have to pass variable in a query string.
> The query string is in the hyperlink coloumn of a datgrid.
> The code appears like this
> <asp:HyperLinkColumn DataNavigateUrlField="ProductID"
> DataNavigateUrlFormatString="ViewProduct.aspx?qProductID='<%strProduct%>'"
> DataTextField="ProductID" HeaderText="Product ID">
> <HeaderStyle Width="10%"></HeaderStyle>
> </asp:HyperLinkColumn>
>
> this does not work..
> Can any one help..
>
Hi,
Thanks..
To continue with ur question..
No '<%=ADstrProduct%>' is a variable which stores the value from a query
string.
The page is accepting a query string which is stored in query string
'qProduct'
I assign qProduct to the public variable strProduct on form load in my
code behind file of asp.net.
the code behind is VB ie I am working on VB.Net.
I hope this clears your question

Passing variables in query string in the HyperLinkColumn of a datagrid

Hi All,
I have to pass variable in a query string.
The query string is in the hyperlink coloumn of a datgrid.

The code appears like this
<asp:HyperLinkColumn DataNavigateUrlField="ProductID"
DataNavigateUrlFormatString="ViewProduct.aspx?qProductID='<%strProduct%>'"
DataTextField="ProductID" HeaderText="Product ID">
<HeaderStyle Width="10%"></HeaderStyle>
</asp:HyperLinkColumn
this does not work..
Can any one help..Where is <%strProduct%>' coming from. Is this a column in your datasource.
If so then you need to sue the binding synthax '<%# strProduct%>'

--
TDAVISJR
aka - Tampa.NET Koder

<aparnasinha26@.yahoo.com> wrote in message
news:1116325678.716477.36020@.z14g2000cwz.googlegro ups.com...
> Hi All,
> I have to pass variable in a query string.
> The query string is in the hyperlink coloumn of a datgrid.
> The code appears like this
> <asp:HyperLinkColumn DataNavigateUrlField="ProductID"
> DataNavigateUrlFormatString="ViewProduct.aspx?qProductID='<%strProduct%>'"
> DataTextField="ProductID" HeaderText="Product ID">
> <HeaderStyle Width="10%"></HeaderStyle>
> </asp:HyperLinkColumn>
>
> this does not work..
> Can any one help..
Hi,
Thanks..
To continue with ur question..
No '<%*strProduct%>' is a variable which stores the value from a query
string.
The page is accepting a query string which is stored in query string
'qProduct'
I assign qProduct to the public variable strProduct on form load in my
code behind file of asp.net.
the code behind is VB ie I am working on VB.Net.

I hope this clears your question