views:

152

answers:

1

I would like to use a TextBoxor Label (item) inside of a Gridview. When field is clicked, I would like to display list of records that contain: - Item Name - Description - Price - Image - Add Button

+2  A: 

It sounds to me like you are talking about having a "filter" option for your GridView.

If I'm reading your post correctly, you would like to be able to enter text into the TextBox and then filter the data within the GridView to show matching records. Below is some pseudo code that will hopefully help get you started...

FRONT END CODE

<asp:TextBox id="myBox" runat="server" OnTextChange="myBox_OnTextChange"></asp:TextBox>
<asp:GridView id="myGrid" runat="server">
    //COLUMN 1
    //COLUMN 2
    //IMAGE TO ADD
</asp:GridView>

CODE BEHIND

//THIS CODE IS NOT CORRECT EXAMPLE ONLY TO GET YOU STARTED
protected void myBox_OnTextChange(EventArgs e)
{
    if(!String.isNullorEmpty(this.myBox.Text))
    {
        //MyFunction will filter your datasource with the text box data and 
        //return a DataSet or DataTable or etc.....
        this.myGrid.DataSource = MyFunction(myBox.Text);
        this.myGrid.DataBind();
    }
}
RSolberg
but in this way the items list will appear when I load the first gridview is that correct?what I need is th view the items list when the user click on the item column in first gridview
Can you look at the question above, I edited it... Let me know if that is what you are looking for.
RSolberg
I looked at it in fact that is not what I need.I don't want to filter the items list what I need is when user click on item column(it could be textbox or label template field) a list of items appear and the user can choos from that list
Like a dropdown menu? Go ahead and edit the question above and maybe provide source code and links to an example of what you are trying to do.
RSolberg