Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5845509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:26:41+00:00 2026-05-22T12:26:41+00:00

In textbox I have to type string which will be searched in a table.

  • 0

In textbox I have to type string which will be searched in a table. if data is found in any of the 3 columns data will be shown in a gridview.3 columns are title, description and keywords. If title chk box is checked it will search through title and if keyword s checked it will search in it. if any of the checkbox is not checked it wont search in tht particular column. I have 2 radio button also one of them need to be selected.if and_radio is clicked it will search data in both columns if or is clicked idf data is found in any of the column will be shown…. Help trying it for a long…It has to be done with procedure.. What code should i have to write on search button click for searching data in textbox and then populate the result in grid
STORED PROCEDURE i used

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

 ALTER Procedure [dbo].[sp_Normal_Search_Library]

 @title AS nvarchar(max), 
  @Description AS nvarchar(max), 
  @Keywords AS nvarchar(max),
 @Chk_title AS BIT ,
 @Chk_Description AS Bit ,
 @Chk_Keywords AS BIT,
 @RD_AND AS BIT,
 @RD_OR AS BIT


 AS 
if @RD_AND = 1 Begin 
    if @Chk_title = 1       
Begin       
Select title from server_des where title Like '%'+@title+'%' 
End     
if @Chk_Description=1   
    Begin   
    Select Description from server_des where Description  Like '%'+@Description+'%'
        End     
if @Chk_Keywords=1  
    Begin
        Select Keywords from server_des where Keywords Like '%'+@Keywords+'%'
        End     
if @Chk_title = 1 AND @Chk_Description = 1 
        Begin   
    Select title, Description from server_des where title Like '%'+ @title+'%' AND Description  Like '%'+@Description+'%'
        End 
    if @Chk_Description=1 AND @Chk_Keywords=1   
    Begin       
Select Description, Keywords from server_des where  Description  Like'%'+@Description+'%' AND  Keywords Like '%'+@Keywords+'%'  
    End 
    if @Chk_title=1 AND @Chk_Keywords=1
        Begin   
    Select title, Keywords from server_des where title Like'%'+@title+'%' AND Keywords Like'%'+@Keywords+'%'        
End     
if @Chk_title=1 AND @Description=1 AND @title=1     
    Begin       
Select title,Description, Keywords from server_des where title Like '%'+@title+'%'AND Description Like '%'+@Description+'%' AND Keywords Like '%' +@Keywords+'%'
        End     
 End    
ELSE IF @RD_OR=0    
Begin
if @Chk_title = 1   
    Begin       
Select title from server_des where title Like'%'+ @title+'%'    
    End     
if @Chk_Description=1       
Begin       
Select Description from server_des where Description  Like '%'+@Description+'%'
        End     
if @Chk_Keywords=1  
    Begin
        Select Keywords from server_des where Keywords Like '%'+@Keywords+'%'
        End     
if @Chk_title = 1 AND @Chk_Description = 1  
    Begin   
    Select title, Description from server_des where title Like '%'+ @title+'%' AND Description  Like '%'+@Description+'%'
        End     
if @Chk_Description=1 AND @Chk_Keywords=1       
Begin       
Select Description, Keywords from server_des where  Description  Like '%'+@Description+'%' AND  Keywords Like '%'+@Keywords+'%'     
    End 
    if @Chk_title=1 AND @Chk_Keywords=1
        Begin   
    Select title, Keywords from server_des where title Like '%'+@title+'%' AND Keywords Like '%'+@Keywords+'%'  
    End 
    if @Chk_title=1 AND @Description=1 AND @title=1     
    Begin   
    Select title, Description, Keywords from server_des where title Like'%'+@title+'%'AND  Description Like '%'+@Description+'%' AND Keywords Like '%' +@Keywords+'%'
        End 
     End

In business logic I created method:

 public DataTable Fillgrid(string title,string Description, string Keywords)
    {
    con.ConnectionString = ConfigurationManager.ConnectionStrings["LibrarySql"].ConnectionString;
    SqlCommand cmd = new SqlCommand();

    cmd.CommandText = "sp_Normal_Search_Library";
    cmd.CommandType = CommandType.StoredProcedure;
    //string query = "select * from Server_des";
    cmd.Parameters.AddWithValue("@title", title);
    cmd.Parameters.AddWithValue("@Description",Description);
    cmd.Parameters.AddWithValue("@Keywords",Keywords);
    cmd.Connection = con;
    SqlDataAdapter sda = new SqlDataAdapter(cmd);
    DataTable  dt = new DataTable();
    con.Open();
    sda.Fill(dt);


    return dt;

Now how do I populate data in the grid on my web form?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:26:42+00:00Added an answer on May 22, 2026 at 12:26 pm

    DataGrid.DataSource = Fillgrid("title","description","keyword");
    DataGrid.Bind();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a databound TextBox in my application like so: (The type of Height
I want to have a text box that the user can type in that
What's the object type returned by Datepicker? Supposing I have the following: $(#txtbox).datepicker({ onClose:
In my application I have TextBox in a FormView bound to a LinqDataSource like
I have three TextBox controls on the page <asp:TextBox ID=TextBox1 runat=server AutoPostBack=True OnTextChanged=TextBox_TextChanged TabIndex=1>
I have a textbox whose input is being handled by jQuery. $('input.Search').bind(keyup, updateSearchTextbox); When
I have a textbox with the Text property bound to a dataset column with
I have a textbox and a link button. When I write some text, select
I have a textbox with an onchange event. Why does this event not fire
I have a TextBox control on my Form. I use the Leave event on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.