The dropdownlist is to filter the @AttachmentEntityId parameter in the
SELECT statement for my grid. Here's the dropdownlist....
<asp
ropDownList ID="ddlStations" runat="server"
DataSourceID="sdsStations"
DataTextField="AttachmentEntityName"
DataValueField="AttachmentEntityId"
Width="143px" AutoPostBack="True"
AppendDataBoundItems="True">
<asp:ListItem Selected="True" Value="%">ALL
STATIONS</asp:ListItem>
</asp
ropDownList>
Here's the SELECT statement for my grid...
SelectCommand="SELECT Appointments.AppointmentId, Appointments.CompanyId,
Appointments.AppointmentName, Appointments.StartDateTime,
Appointments.EndDateTime, Appointments.RecurranceStorage,
Appointments.RecurranceParentKey, Appointments.CreatedByCompanyUserId,
Appointments.CreateDateTime, Appointments.Comments,
AppointmentAttachments.AttachmentEntityId FROM Appointments INNER JOIN
AppointmentAttachments ON Appointments.AppointmentId =
AppointmentAttachments.AppointmentId WHERE (Appointments.CompanyId =
@CompanyId) AND (AppointmentAttachments.AttachmentEntityId =
@AttachmentEntityId)"
<SelectParameters>
<asp:ControlParameter ControlID="ddlCompany" Name="CompanyId"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="ddlStations"
Name="AttachmentEntityId"
PropertyName="SelectedValue" />
</SelectParameters>
Again, the error is...
Conversion failed when converting the nvarchar value '%' to data type int.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Conversion failed
when converting the nvarchar value '%' to data type int.
Any ideas? Thanks.
I seem to remember seeing a solution where a databound dropdownlist (used
as
a FILTER for a gridview) had the 1st item as "ALL ITEMS". It used a query
with a UNION. But I can't find the example.
It used no code I believe.
Anyone have this solution handy?
Thanks!
Hi
While Configure the data source if you want to set the where clause ,
there is a option that takes param directly from a control
select configure datasource of your datasource...
and then click next to go to the configure select statement...
you will find a button called "where" in the wizard...
click on that... will lunch add new where wizard...
there you can specify column and operator and source from the param ..
there in source drop down you will find a value called from
"control"...
select that and specify the value and default value...
Best of luck
Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com