Click here to Skip to main content
14,216,325 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have a grid view to display all the records from database.. Now I require a search box. the required design goes like this.

Name | Address | Contact

All the records are displayed in grid. first row displayed the column header and second row displays record from database.. now i want a text boxes in second row (i.e. below respective column header) and record from database in 3rd row. If user enters the name in textbox below column header name. the search must be done based on the name.. I had tried few tags in .aspx page using header template tag but could not get desired output. Any help???
Posted
Comments
JoCodes 1-Oct-13 5:59am
   
which approach you have already tried out?
JoCodes 1-Oct-13 6:26am
   
Please change your subject line too according to get more accurate responses since its just about adding textbox as row in gridview
Codes DeCodes 1-Oct-13 7:43am
   
thanks for the reply jocodes.. I had tried with

<HeaderTemplate>
<asp:TextBox ID="TextBoxEmployee" runat="server"/>
</HeaderTemplate>

it was just a try and the textbox was shown in header as expected..
JoCodes 1-Oct-13 8:02am
   
I have posted a link as a solution which takes care of your inline search scenario..
Codes DeCodes 2-Oct-13 0:26am
   
ya. got it.. thats a clever technique though.. I was searching for input box using grid view.. Not as a table. Nyway thanks for your help..
Rate this:
Please Sign up or sign in to vote.

Solution 1

on click of row event of grid you can add code like this to create a textxbox.

protected void grd_RowEditing(object sender, GridViewEditEventArgs e) 
{
     GridViewRow selectRow = grd.Rows(e.NewEditIndex);
     TextBox txtKj=(TextBox)selectRow.Cells[3].FindControl("txtKjId"); 
}


Hope this help.
-SG
   
Comments
Codes DeCodes 2-Oct-13 5:13am
   
I am developing the solution in version 3.5 and (e.NewEditIndex) is not supported.. do u have any idea ??
Rate this:
Please Sign up or sign in to vote.

Solution 2

You can try something in the below link which takes care of your search need exactly ( inline Gridview search feature )

Integrating Inline Search in a GridView's Header[^]

Hope this helps


[Edit member="Tadit"]
Link text added to reflect the article title.
[/Edit]
   
v3
Rate this:
Please Sign up or sign in to vote.

Solution 3

   
Rate this:
Please Sign up or sign in to vote.

Solution 4

<asp:templatefield headertext="xxx" xmlns:asp="#unknown">

<itemtemplate>

<asp:textbox runat="server" id="Duties" text="<%#Eval(" xxx")="" %&gt;"="" clientidmode="Static">


   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190619.2 | Last Updated 1 Oct 2013
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100