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">
<SelectParameters>
<asp:Parameter Name="OrderId" Type="Int32" DefaultValue="@OrderId" />
<asp:FormParameter Name="Editable" Type="Int32" FormField="Editable" />
</SelectParameters>
Defining the value in the SQL Server query window gives me lots of records.
Declare @Editable Int
SET @Editable=1
SELECT *, (@Editable) AS Editable FROM[DBO].[vueOrders] WHERE ([OrderId] = @OrderId) Order By OrderDate Desc