Friday, February 24, 2012

C# Master-Details (Separate Pages)

My question is setting up master detail pages using stored procedrues. In the tutorials C# Master-Details (Seperate Pages) example they use the following code for the master page for the navigation.

<asp:HyperLinkField HeaderText="View Details..." Text="View Details..." DataNavigateUrlFields="au_id"
DataNavigateUrlFormatString="DetailsView_cs.aspx?ID={0}" />

The call to the Details PageDetailsView_cs.aspxuses the following code

<asp:SqlDataSource ID="SqlDataSource1" Runat="server" SelectCommand="SELECT dbo.authors.au_id, dbo.titles.title_id, dbo.titles.title, dbo.titles.type, dbo.titles.price, dbo.titles.notes FROM dbo.authors INNER JOIN dbo.titleauthor ON dbo.authors.au_id = dbo.titleauthor.au_id INNER JOIN dbo.titles ON dbo.titleauthor.title_id = dbo.titles.title_id WHERE (dbo.authors.au_id = @.au_id)"
ConnectionString="<%$ ConnectionStrings:Pubs %>">

<SelectParameters>
<asp:QueryStringParameter Name="au_id" DefaultValue="213-46-8915" QueryStringField="ID"/>
</SelectParameters>
</asp:SqlDataSource>

I can replicate the example calling the detail page but I am unable to make the detail page work when using a stored procedure as the asp:SQLDataSource. Using the above sql code as a stored procedure in the <SelectParameters> I am not able to return the data set using either asp:QueryStringParameter or asp:Parameter as I have built other forms using stored procedures and have tested the procedure and know that it works. Can someone point me in the right direction.

Thanks

The soulution works the same with stored procedures but you need to have

EnableSortingAndPagingCallbacks="false" not true

|||I spoke to soon, my previous post did not resole the issue of calling a stored procedure from the detail page. The master page passes the correct value to the detail but the procedure does not recognize it.

No comments:

Post a Comment