linqdatasource

How can I prevent the LinqDataSource Where clause from resetting on postback?

核能气质少年 提交于 2019-12-05 19:18:46
I'm trying to set the where clause on a LinqDataSource object bound to a GridView programmatically on a button click, but when the GridView rebinds data (for instance, when the user sorts) the Where clause resets back to the empty string. Is there a way to prevent this, or is there a better way to filter my results? justin.lovell Perhaps you just add a ViewState property into your page/user control and then retrieve it on all post back? public string MyLinqSourceWhere { get { return (string)this.ViewState["MyLinqSourceWhere"]; } set { this.ViewState["MyLinqSourceWhere"] = value; } } public

LinqDataSource does not support the Select property when the Delete, Insert or Update operations are enabled

為{幸葍}努か 提交于 2019-12-05 05:58:11
I am getting this error when clicking the Delete button / link in a GridView control. LinqDataSource [DataSource] does not support the Select property when the Delete, Insert or Update operations are enabled I don't really understand why I'm getting this error because I have already done the same thing on a different webpage in my site, however the table that the data is read from in that case does not have any foreign keys, this one does. Is that why I am getting the error? If it matters, the AutoGenerateDeleteButton property is set to True and I am using a linqdatasource to retrieve the data

LinqDataSource: Filtering and binding to gridview

假装没事ソ 提交于 2019-12-02 20:12:01
问题 the problem is not solved the way i wanted but i go ahead give the credit to : ŁukaszW.pl for his time and effort. i am using gridview control and a linqdatasource and its all working fine and i have added the functionlity of searchingBySubject and i added WhereParameters and than binding my gridview (see the code below) but somehow its not returning any rows and i see i have number of rows based on what i am searching. protected void btnSearch_Click(object sender, EventArgs e) { this

LinqDataSource: Filtering and binding to gridview

∥☆過路亽.° 提交于 2019-12-02 08:28:25
the problem is not solved the way i wanted but i go ahead give the credit to : ŁukaszW.pl for his time and effort. i am using gridview control and a linqdatasource and its all working fine and i have added the functionlity of searchingBySubject and i added WhereParameters and than binding my gridview (see the code below) but somehow its not returning any rows and i see i have number of rows based on what i am searching. protected void btnSearch_Click(object sender, EventArgs e) { this.LinqDataSource1.WhereParameters["Subject"].DefaultValue = this.txtSubject.Text; this.GridView1.DataBind(); }

LINQDataSource - Query Multiple Tables?

不羁岁月 提交于 2019-12-01 23:20:56
I have a database and I've created a DBML Linq-to-SQL file to represent this database. I've created a new aspx page and dropped a linqdatasource and a formview control onto it. When I configure the linqdatasource it gives me the choice only to select * from one table...but I want to pull from multiple tables. e.g. I have tables like simple_person, simple_address, simple_phone, and I want to pull from all of them. How can I accomplish this? Use a custom query http://weblogs.asp.net/scottgu/archive/2007/09/07/linq-to-sql-part-9-using-a-custom-linq-expression-with-the-lt-asp-linqdatasource-gt