Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
06-16-2011, 05:34 PM #1
- Join Date
- Jun 2011
- Thanked 0 Times in 0 Posts
Can you use a select parameter as a field in the dataset?
Does anyone know if it is possible to use a select parameter as a field in the table using SqlDataSource? I have a function that determines edit rights. I can store the value in a hidden field on the page. If I could get that value into the data table the grid uses, I could use it to set buttons in a master/detail grid that uses templates for the edit and delete buttons. I don't want to call the function for every record in the dataset - that could take a while. And dumping the SQLDataSource means coding the update, insert, delete and select statements.
I tried the following, but I get no records and no errors.
SelectCommand="SELECT *, (@Editable) AS Editable FROM[DBO].[vueOrders] WHERE ([OrderId] = @OrderId) Order By OrderDate Desc">
<asp:Parameter Name="OrderId" Type="Int32" DefaultValue="@OrderId" />
<asp:FormParameter Name="Editable" Type="Int32" FormField="Editable" />
Defining the value in the SQL Server query window gives me lots of records.
Declare @Editable Int
SELECT *, (@Editable) AS Editable FROM[DBO].[vueOrders] WHERE ([OrderId] = @OrderId) Order By OrderDate Desc