|
Following Should be the Code of Object data source in source file
< asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="DisplayDoctorsbyId" TypeName="DoctorsBLL"
DeleteMethod="DeletemdnationdoctorsById" >
<selectparameters>
<asp:parameter name="id" defaultvalue="-1" type="Int32">
<asp:parameter name="sLastName" type="string" defaultvalue=" ">
There is store procedure which is called in select method of Object data source it is for displaying data on the basis of search u do
ALTER PROC [dbo].[Proc_DisplaymdnationdoctorsById]
@id int,
@SLastNAME VARCHAR(50)
AS
BEGIN
SET NOCOUNT ON
IF(@id > 0)
BEGIN
SELECT MD.id, MD.FirstName, MD.LastName,MD.MInitial,MD.BirthDate,MD.BirthCity,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.BirthState
) As BirthCountry,
MD.BirthState, MD.BirthNation, MD.StateMedicalBoard, MD.Contact_Address, MD.Contact_City, MD.Contact_State,
MD.Contact_Zip, MD.Contact_Country, MD.Contact_Telephone, MD.Contact_Fax, MD.Cert_Certification, MD.Cert_Date,
MD.Cert_Expires, MD.Cert_ReCertification, MD.Cert_SubCertification,MD.Cert_SubCertificationDate,
MD.Cert_SubCertification_Expires, MD.Cert_Recapitulation, MD.Edu_Degree, MD.Edu_School, MD.Edu_SchoolYears,
MD.Fell_Specialty1, MD.Fell_Organization1,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Fell_State1
) As Fell_Country1,
MD.Fell_State1, MD.Fell_City1, MD.Fell_CareerYears1, MD.Fell_Specialty2, MD.Fell_Organization2,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Fell_State2
) As Fell_Country2,
MD.Fell_State2, MD.Fell_City2, MD.Fell_CareerYears2, MD.Fell_Specialty3, MD.Fell_Organization3,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Fell_State3
) As Fell_Country3,
MD.Fell_State3, MD.Fell_City3,MD.Fell_CareerYears3, MD.Res_Specialty1, MD.Res_Organization1,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Res_State1
) As Res_Country1,
MD.Res_State1, MD.Res_City1, MD.Res_CareerYears1, MD.Res_Specialty2, MD.Res_Organization2,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Res_State2
) As Res_Country2,
MD.Res_State2, MD.Res_City2, MD.Res_CareerYears2, MD.Res_Specialty3, MD.Res_Organization3,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Res_State3
) As Res_Country3,
MD.Res_State3, Res_City3, MD.Res_CareerYears3, MD.Inter_Organization,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Inter_State
) As Inter_Country,
MD.Inter_State, MD.Inter_City, MD.Inter_CareerYears, MD.Mem_Memberships1, MD.Mem_Awards1,
MD.Mem_Publication1, MD.Mem_Memberships2, MD.Mem_Awards2, MD.Mem_Publication2, MD.Mem_Memberships3,
MD.Mem_Awards3, MD.Mem_Publication3, MD.Mem_Memberships4, MD.Mem_Awards4, MD.Mem_Publication4,
MD.Mem_Memberships5, MD.Mem_Awards5, MD.Mem_Publication5, MD.Mem_Memberships6, MD.Mem_Awards6,
MD.Mem_Publication6, MD.Mem_Memberships7, MD.Mem_Awards7, MD.Mem_Publication7, MD.Mem_Memberships8,
MD.Mem_Awards8, MD.Mem_Publication8, MD.Mem_Memberships9, MD.Mem_Awards9, MD.Mem_Publication9,
MD.Mem_Memberships10, MD.Mem_Awards10, MD.Mem_Publication10, MD.sysdate, MD.Special_Expertise
FROM mdnation_doctors MD WHERE MD.id = @id AND MD.LASTNAME LIKE ''+ltrim(rtrim(@SLastNAME))+'%'
END
else
BEGIN
SELECT MD.id, MD.FirstName, MD.LastName,MD.MInitial,MD.BirthDate,MD.BirthCity,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.BirthState
) As BirthCountry,
MD.BirthState, MD.BirthNation, MD.StateMedicalBoard, MD.Contact_Address, MD.Contact_City, MD.Contact_State,
MD.Contact_Zip, MD.Contact_Country, MD.Contact_Telephone, MD.Contact_Fax, MD.Cert_Certification, MD.Cert_Date,
MD.Cert_Expires, MD.Cert_ReCertification, MD.Cert_SubCertification,MD.Cert_SubCertificationDate,
MD.Cert_SubCertification_Expires, MD.Cert_Recapitulation, MD.Edu_Degree, MD.Edu_School, MD.Edu_SchoolYears,
MD.Fell_Specialty1, MD.Fell_Organization1,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Fell_State1
) As Fell_Country1,
MD.Fell_State1, MD.Fell_City1, MD.Fell_CareerYears1, MD.Fell_Specialty2, MD.Fell_Organization2,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Fell_State2
) As Fell_Country2,
MD.Fell_State2, MD.Fell_City2, MD.Fell_CareerYears2, MD.Fell_Specialty3, MD.Fell_Organization3,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Fell_State3
) As Fell_Country3,
MD.Fell_State3, MD.Fell_City3,MD.Fell_CareerYears3, MD.Res_Specialty1, MD.Res_Organization1,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Res_State1
) As Res_Country1,
MD.Res_State1, MD.Res_City1, MD.Res_CareerYears1, MD.Res_Specialty2, MD.Res_Organization2,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Res_State2
) As Res_Country2,
MD.Res_State2, MD.Res_City2, MD.Res_CareerYears2, MD.Res_Specialty3, MD.Res_Organization3,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Res_State3
) As Res_Country3,
MD.Res_State3, Res_City3, MD.Res_CareerYears3, MD.Inter_Organization,
(select Countries_name from countries MC
Inner Join mdnation_states MS on MS.Countries_id = MC.Countries_id
Where MS.state_name = MD.Inter_State
) As Inter_Country,
MD.Inter_State, MD.Inter_City, MD.Inter_CareerYears, MD.Mem_Memberships1, MD.Mem_Awards1,
MD.Mem_Publication1, MD.Mem_Memberships2, MD.Mem_Awards2, MD.Mem_Publication2, MD.Mem_Memberships3,
MD.Mem_Awards3, MD.Mem_Publication3, MD.Mem_Memberships4, MD.Mem_Awards4, MD.Mem_Publication4,
MD.Mem_Memberships5, MD.Mem_Awards5, MD.Mem_Publication5, MD.Mem_Memberships6, MD.Mem_Awards6,
MD.Mem_Publication6, MD.Mem_Memberships7, MD.Mem_Awards7, MD.Mem_Publication7, MD.Mem_Memberships8,
MD.Mem_Awards8, MD.Mem_Publication8, MD.Mem_Memberships9, MD.Mem_Awards9, MD.Mem_Publication9,
MD.Mem_Memberships10, MD.Mem_Awards10, MD.Mem_Publication10, MD.sysdate, MD.Special_Expertise
FROM mdnation_doctors MD WHERE MD.LASTNAME LIKE ''+ltrim(rtrim(@SLastNAME))+'%'
END
END
This Should come under cs file on button click, add text box though to enter the text you want to search
if (tbPhysicians.Text.Trim() != "")
{
//ObjectDataSource1.FilterExpression="LastName LIKE '%" + tbPhysicians.Text + "%'";
ObjectDataSource1.SelectParameters["id"].DefaultValue = "-1";
ObjectDataSource1.SelectParameters["slastname"].DefaultValue = DoctorName;
}
else
{
ObjectDataSource1.SelectParameters["id"].DefaultValue = "-1";
ObjectDataSource1.SelectParameters["slastname"].DefaultValue = " ";
}
ObjectDataSource1.DataBind();
|
|
|
|