I connected SQLDataSource in GridView by using coding
Expand|Select|Wrap|Line Numbers
- <asp:GridView ID="Search_GridView" runat="server" Style="z-index: 100; left: 2px; position: absolute;
- top: 270px" AutoGenerateColumns="False" OnSelectedIndexChanged="Search_GridView_SelectedIndexChanged" CellPadding="20" Width="720px" AllowPaging="True" OnPageIndexChanging="Search_GridView_PageIndexChanging" DataSourceID="SqlDataSource1">
- <Columns>
- <asp:hyperlinkfield headertext="Doctors Name"
- datatextfield="DoctorsName"
- datanavigateurlfields="DoctorsName"
- datanavigateurlformatstring="Logging.aspx?DoctorsName={0}" />
- <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
- <%--<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
- <asp:BoundField DataField="PrimaryTitle" HeaderText="PrimaryTitle" SortExpression="PrimaryTitle" />
- <asp:HyperLinkField Text="Fix an Appointment" HeaderText="Appointment Fixing" NavigateUrl="~/Appointment.aspx"/>
- --%>
- </Columns>
- <HeaderStyle BackColor="InactiveCaption" BorderWidth="0px" />
- <AlternatingRowStyle BackColor="Silver" />
- </asp:GridView>
- <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Hello_DrConnectionString6 %>" <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Hello_DrConnectionString6 %>" SelectCommand="SELECT [DoctorMaster].[FirstName]+''+[DoctorMaster].[MiddleName]+''+[DoctorMaster].[LastName] as DoctorsName, [DrClinicDetails].[Address], [DoctorMaster].[Telephone]+','+[DoctorMaster].[Mobile] as Phone, [PrimaryTitle].[PrimaryTitle] FROM [DoctorMaster], [DrClinicDetails], [PrimaryTitle], [Specialty] WHERE (([DoctorMaster].[FirstName] = @FirstName) OR ([Specialty].[Specialty] = @Specialty) OR ([DoctorMaster].[City] = @City) AND ([DoctorMaster].[DRID]=[DrClinicDetails].[DRID]) AND ([DoctorMaster].[SPID]=[Specialty].[SPID]) AND ([PrimaryTitle].[PTID]=[DoctorMaster].[PrimaryTitleID]))">
- <SelectParameters>
- <asp:ControlParameter ControlID="Label1" Name="FirstName" PropertyName="Text" Type="String" />
- <asp:ControlParameter ControlID="Label2" Name="Specialty" PropertyName="Text" Type="String" />
- <asp:ControlParameter ControlID="Label3" Name="City" PropertyName="Text" Type="String" />
- </SelectParameters>
- </asp:SqlDataSource>