views:

55

answers:

2

AllowSorting="True" AutoGenerateColumns="False" DataSourceID="LinqDataSource1"> SortExpression="UserName" /> SortExpression="FullName" /> SortExpression="Email" /> SortExpression="LastLoginDate" DataFormatString="{0:dd MMMM yyyy}"/>

<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MyDataContextDataContext" onselecting="LinqDataSource_Selecting">  
        <WhereParameters>  
           <asp:Parameter Name="Subject" /> 
        </WhereParameters>  
</asp:LinqDataSource> 

 public void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
                this.LinqDataSource1.WhereParameters["Subject"].DefaultValue =  this.txtSubject.Text;
               e.Result = reporterRepo.GetInquiries(); 
A: 

Try using this, or modify it till it works. If I'm correct I did something like this before:

public void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
   this.LinqDataSource1.WhereParameters["Subject"].DefaultValue =  this.txtSubject.Text;
   GridView2.DataBind();
   e.Cancel = true;
}
citronas
does not refresh and i am reterving the correct data from the database and does not bind the gridview and still throws me all the rows instead of 2 rows (based on my search result)
Abu Hamzah
Make sure your intial databind on pageload is not executed on postbacks. Be aware that the Selecting Eventhandler is called after the Page_Load event.
citronas
i dont have anything that bind to gridview in the page_load
Abu Hamzah
A: 

my gridview was in updatepanel thats why it was not refreshing the gridview

 <asp:UpdatePanel....  
Abu Hamzah