Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Paul Gray via DotNetMonster.com #1
Query string and Parameter Passing Problem
Hi
In the context of a Master/Detail scenario, I am having trouble figuring
out the correct syntax for passing a parameter in a query string in a
HyperLink Column, but the parameter is coming from a seperate bound column,
which is not visible and so cannot itself be used as the hyperlink column
If I want to pass the parameter from my Hyperlink column, it is fine,
DataNavigateUrlFormatString="detailsPage.aspx?ID={ 0}"
but how do I reference my invisible bound column, that is, the unique 'ID'
one,
<asp:BoundColumn HeaderText="ID" DataField="ID" Visible="False" />
and pass it as a parameter in the query string
DataNavigateUrlFormatString="detailsPage.aspx?ID={ 0}"
My Datagrid is as follows
<asp:DataGrid ID="dgrdMenu" Runat="Server"
AutoGenerateColumns="false">
<Columns>
<asp:BoundColumn HeaderText="ID" DataField="ID" Visible="False"
/>
<asp:BoundColumn HeaderText="Code" DataField="Code" />
<asp:HyperLinkColumn
HeaderText="Product Description"
DataNavigateUrlField="Description"
DataNavigateUrlFormatString="detailsPage.aspx?ID={ 0}"
DataTextField="Description"
Target="_new" />
<asp:BoundColumn HeaderText="Price" DataField="Retail"/>
</Columns>
</asp:DataGrid>
and my SQL string is "Select ID, Code, Description, Retail from
Pricelist0804 WHERE
Description LIKE '%' + @name + '%' ";
I would be grateful if anyone could give me the exact syntax
--
Message posted via [url]http://www.dotnetmonster.com[/url]
Paul Gray via DotNetMonster.com Guest
-
Multi-parameter query string in hyperlink column...
I have found some postings on multi-parameter hyperlinks. But none of them involve calling a javascript function. I have almost got the NavigateUrl... -
Passing XML in a string parameter
We have a parameter to a webmethod that is defined as a string. We expect to pass XML in this string. What we've found out is that the .Net web... -
Passing a Large String as a parameter to a web service
Hello I have a situation where I might pass a large string as a parameter to a webservice. The string size could go upto 100 MB. Is there a... -
Using query string to pass a value to a stored procedure parameter
All, I want to push on a form button in an HTML page and pass a query string to the ASP.NET page I’m opening. That query string has the... -
Passing Unicode String as Web Method Parameter
All web requests and responses by default under ASP.NET are sent as unicode and are encoded as unicode UTF8. This can be changed in the... -
Elton W #2
Query string and Parameter Passing Problem
Hi Paul,
If you want to pass ID rather than Description as query
string to hyperline, you can do it in
datagrid_ItemDataBound event:
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem )
{
DataRowView drv = (DataRowView)e.Item.DataItem;
HyperLink link = (HyperLink)e.Item.Cells
[2].Controls[0];
link.NavigateUrl="detailsPage.aspx?ID=" + drv
["ID"].ToString();
}
HTH
Elton Wang
[email]elton_wang@hotmail.com[/email]
trouble figuring>-----Original Message-----
>Hi
>
>In the context of a Master/Detail scenario, I am havingstring in a>out the correct syntax for passing a parameter in a queryseperate bound column,>HyperLink Column, but the parameter is coming from ahyperlink column>which is not visible and so cannot itself be used as theit is fine,>
>If I want to pass the parameter from my Hyperlink column,is, the unique 'ID'>
>DataNavigateUrlFormatString="detailsPage.aspx?ID= {0}"
>
>
>but how do I reference my invisible bound column, thatVisible="False" />>one,
>
> <asp:BoundColumn HeaderText="ID" DataField="ID"DataField="ID" Visible="False">
>and pass it as a parameter in the query string
>
>DataNavigateUrlFormatString="detailsPage.aspx?ID= {0}"
>
>My Datagrid is as follows
>
><asp:DataGrid ID="dgrdMenu" Runat="Server"
>
> AutoGenerateColumns="false">
>
> <Columns>
> <asp:BoundColumn HeaderText="ID"DataField="Code" />>/>
> <asp:BoundColumn HeaderText="Code"DataNavigateUrlFormatString="detailsPage.aspx?ID={ 0}"> <asp:HyperLinkColumn
> HeaderText="Product Description"
> DataNavigateUrlField="Description"
>DataField="Retail"/>> DataTextField="Description"
> Target="_new" />
> <asp:BoundColumn HeaderText="Price"Retail from> </Columns>
>
> </asp:DataGrid>
>
>and my SQL string is "Select ID, Code, Description,syntax>Pricelist0804 WHERE
>
>Description LIKE '%' + @name + '%' ";
>
>I would be grateful if anyone could give me the exact>
>--
>Message posted via [url]http://www.dotnetmonster.com[/url]
>.
>Elton W Guest
-
Paul Gray via DotNetMonster.com #3
Re: Query string and Parameter Passing Problem
Thanks Elton, I will try that
--
Message posted via [url]http://www.dotnetmonster.com[/url]
Paul Gray via DotNetMonster.com Guest



Reply With Quote

