I have an ASP.NET website I am trying to build with a master-detail scenario. I am using a gridview on the master page, an Access DB, and the UltraWebGrid for the detail page. I seem to be having an issue with passing a parameter to the detail page-- it is passed from the Master page, and then when you are redirected to the correct URL for the detail page (...detail.aspx?EmployeeID=5), I recieve an error that there is 'no value given for one or more required parameters.'
However, because the URL reads ...details.aspx?EmployeeID=1 I believe it is not a problem passing the parameter, but rather a problem on the recieving end. On my details page, I have the ultrawebgrid and an SQLDataSource.
The SqlDataSource is configured with the query:
SELECT tblName.Last_Name, tblName.First_Name, tblLocality.Locality, tblPosition.[Position] FROM (((tblFCCCrosswalk INNER JOIN tblLocality ON tblFCCCrosswalk.Locality_ID = tblLocality.Locality_ID) INNER JOIN tblName ON tblFCCCrosswalk.Emp_ID = tblName.Emp_ID) INNER JOIN tblPosition ON tblFCCCrosswalk.Position_ID = tblPosition.Position_ID) WHERE (tblFCCCrosswalk.Emp_ID = @EmployeeID).
Actually when I test the query I am also getting an error: No value given for one or more parameters... rather than a VS prompt asking me for the value of the parameter....so maybe I don't have the correct syntax. Anyways, any help would be much appreciated :)
So after some time spent working on other projects it came to me, and i wanted to post my answer for the search records....
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT tblName.Last_Name, tblName.First_Name, tblLocality.Locality, tblPosition.[Position] FROM (((tblFCCCrosswalk INNER JOIN tblLocality ON tblFCCCrosswalk.Locality_ID = tblLocality.Locality_ID) INNER JOIN tblName ON tblFCCCrosswalk.Emp_ID = tblName.Emp_ID) INNER JOIN tblPosition ON tblFCCCrosswalk.Position_ID = tblPosition.Position_ID) WHERE (tblFCCCrosswalk.Emp_ID = @EmployeeID)">
<SelectParameters>
<asp:QueryStringParameter Name="EmpID" QueryStringField="EmployeeID"/>
</SelectParameters>
</asp:SqlDataSource>
So.... the only thing I was missing was the three bold-faced lines of code above.... DOH! Oh well... learning experience...