ViewState is active and I have a RadioButtonList with DataSourceID to LinqDataSource.If I postback and cause event SelectedIndexChanged, I can read the SelectedValue property, but if the postback is caused by another control, SelectedValue its always empty...Note if I turn ViewState off, works fine, SelectedValue has always a non empty string...
I have a radiobuttonlist inside a datalist itemtemplate and i need to bind the radiobuttonlist dynamically from database I have tried to bind it inside itemdatabound event of datalist but it the result is always duplicated according to the fields in teh database.
for more information:
the database has two columns one for questions and the other is for choices , for the first question with id lets say 1 there are 4 choices, when the radiobutton is binded the result appears to be 4 times duplicated ?
I have written the below pages (base of question) to populate my asp.net listview control from an objectdatasource. To allow for easier CRUD commands and to make my application more efficient I want to replace this objectdatasource with a linqdatasource but when I attempt this I receive a binding error which stops my ItemDataBound event firing? I'm basically replacing my objectdatasource with the below linqdatasource...
[Code]....
[Code]....
Am I placing my query within the wrong event? Why does my ItemDataBound event not fire?
In my web app, I used LinqDataSource, ListView and DataPager (.NET 3.5 sp1) to implement search feature with paging. I have a button to trigger the search.
But In the first time, the Selecting event of LinqDataSource fire twice and I don't know why (I debugged my code very carefully). I don't use QueryString with DataPager and assign PageSize of DataPager in the first time of page load to prevent the ListView bind again (as in some instructions I found in forum)
I have the datapager working great. I have linkbuttons with certain commandnames and in the listview _itemcommand implement what to do when the linkbuttons are clicked. I have it now where I requery the lindatasource(LinqDataSource1.Where = "Category = ""Metals""") it works fine. When the linkbutton is clicked the datapager acts correct showing the right results, but when I click on the next page it resets to the linqdatasource1 results w/ out the where clause I implemented in the command. How do you maintain the datapager after you requery the linqdatasource in the codebehind.
Im making a Master details web page ASP.NET. I have one aspx page with all the items in a listview, then a link to another page to show the details view, but I dont want to use a asp:detailsview control becasue it generates a table, and I want a more complex layout. I want work each property of the item, but I dont know how. I want to do in LINQ. This is my very bad aprox: I need an orientation of how to get ONLY one item from the LinqDataSource on the page load and not to query the database everytime I need a column. I dont need biding because I only need to show data, not insert, not update, not delete...
The second one references the first one, that is each order is assigned to the client. Now suppose I have an .aspx page with a LinqDataSource for Orders table, and a GridView that uses this datasource and displays a table with a following columns:
Order name. Order desc. Client name. Client address.
As far as I understand, the Linq to SQL is designed in such a way, that by default it does not load any associated entities, it only does it when a child property is requested. So, when a page is loaded, the following situation will occur:
First query will retrieve the records from the Orders table. For each row displayed by GridView an additional query will be performed when one of the client properties is requested. Therefore, if we have 100 orders, this means will perform 101 queries instead of one (or even maybe 201, if a query will be performed for each client property)? How to avoid this and make LinqDataSource load all the required fields by a single query? Right now I see the only workaround for this problem - use an SqlDataSource with a join query, that will retrieve all required fields at once.
<asp:LinqDataSource ID="LinqDataSource3" runat="server" OnSelecting="LinqDataSource3_OnSelecting"> </asp:LinqDataSource> And I have ASPxGridView <dxwgv:ASPxGridView ID="ASPxGridView2" ClientInstanceName="ASPxGridView2Client" runat="server" AutoGenerateColumns="False" DataSourceID="LinqDataSource3"> </dxwgv:ASPxGridView>
In this way Im able to add columns dynamically while handling onSelecting event:
protected void LinqDataSource3_OnSelecting(object sender, LinqDataSourceSelectEventArgs e) { MyModelDataContext context = new MyModelDataContext(); ASPxGridView grid = ASPxPageControl1.TabPages[3].FindControl("ASPxGridView2") as ASPxGridView; if(grid.Columns.Count == 0){ GridViewDataTextColumn txtColumn1 = new GridViewDataTextColumn(); GridViewDataTextColumn txtColumn2 = new GridViewDataTextColumn(); txtColumn1.FieldName = "UserId"; txtColumn2.FieldName = "FirstName"; grid.Columns.Add(txtColumn1); grid.Columns.Add(txtColumn2); } e.Result = from u in context.Users select new { UserId = u.UserId, FirstName = u.FirstName }; }
It is all made simply to test cause my idea is to have solution that makes it possible to use inqDataSource as a datasource for de ASPxGridView but join 2 or 3 tables and show results in this grid.
What I want to ask is if its good solution or is there any other better way to present some views made from couple of tables by join?
Second question is that I have Users and Group and I would like to have one table in which I would have two columns Name and Type For groups type would by group and for users type would be user. I dont have such a table in my database Is it possible to create specific class. Create List of objects of that class and fill it using linq query and the use it as linq data source for that grid ?
clas would be:
pseudocode:
Class MyClass { string Type; string Name; }
or is there any other way to create such a table ?
Im trying to build a where clause in c# for a LinqDataSource, but I cant get it to work, heres my code
[Code]....
when I set category to 'Concerts' tyhe where clause is
'Category = Concerts'
this generates an error telling me there is no column called 'Concerts'. I assume I somehow have to enclose the search term in quotes, Ive tried single and double quotes, but nothing works.
So I need to take the literal "SELECT....FROM Bay....WHERE Warehouse=1 and ((BAY LIKE '1.0%' or BAY LIKE '2.0%'))I have set up a linqdatasource on my asp page and I want to bind that to a gridview. Here is the start of the HTML:
I have a Listview that I want to read the results of a Stored procedure. I have created the DBML object with the table and the stored procedure. When I configure my LinqDataSource on the page I cannot specify the SProc - only the Table. Or do I need to do it in the Listview?
I have a LinqDataSource and a GridView displaying a table. Columns of type xml don't show up. I'd like them to show up something like they do in Sql Server query outputs, with a link to display the clickable xml, though there may be another approach i'm not considering (maybe a styled display of the xml data, etc.). Two things i'd like to know how to do
First, get the xml converted to a string, and display it in the table. Maybe the first 30 chars. Finally, style the xml into something useful, like a clickable link to display the full xml, or a sub-table, or a styled string.
So the following works, and displays a nice table, with edit and delete links. But Xml fields are missing. How would you go about adding support for the Xml fields?
Here's the scenario: ASP.NET 3.5 C# app connecting to an MS SQL backend. I created a LINQ to SQL class called test.dbml and dragged a table called tblTest to the design surface. The table has two columns: the primary key is Email and the other column is Name. Then I dropped a LinqDataSource on the page. The LinqDataSource is not connected to a databound control. It will only being used to retrieve the name associated with a supplied email address. In the Page_Load event, I feed the Where clause:
[Code]....
However, I put a breakpoint inside the ldsAdmin_Selected event and it never hits. With an ObjectDataSource, you can use odsAdmin.Select(); to trigger the ObjectDataSource to actually run and return the info. What's the equivalent method of triggering a LinqDataSource?
I have the following code that seems like it should set my insertParameter but everytime an insert happens it uses the default parameter. Do i need to do anything special to make this work?
I've a gridview bound to linqdatasource1 and a details bound to linqdatasource2 (for searching).
When I update the data on detailsview, my gridview is not updating. I've tried handling various gridview events and databinding the gridview in code but it doesn't seem to work.
i have a grdidview control on the .aspx page and i am trying to connect dynamically from code behind and bind the gridview but somehow it throwing me an error... what is wrong with this code?
LinqDataSource LDS_POReport = new LinqDataSource(); LDS_POReport.ContextTypeName = "DataContextDataContext"; LDS_POReport.Selecting += new EventHandler<LinqDataSourceSelectEventArgs>(LinqDataSourcePO_Selecting); this.gvReport.DataSource = "LDS_POReport"; //this.gvReport.DataBind();
Update:
after i update the code to this.gvReport.DataSource = LDS_POReport;
it works fine but when i try to sort i get this error:
The GridView 'gvReport' fired event Sorting which wasn't handled.
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.
I'm using a LinqDataSource with a RadGrid. When I Add a new Grid item and click insert the values are immediately saved to the database.Is there a way where they can be actually not put in the database until I give the command?
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.
I am writing an ASP.Net web application. I have listview, it's datasource is a LinqDataSource. In my database, I have a staff table and I am trying filter for records by their team using a dropdownlist. This works fine, until I select "All" in the dropdownlist. It returns all staff except for the ones where the teamID is null. How can I return the records where teamID is null?
Orders OrderProducts - An order can have 1 to many orderProducts records associated with it.
What I am trying to do (unsuccessfully) is to implement a GridView search using a LinqDataSource wherein the search returns Order results where any of the OrderProduct.Manufacturer columns contain a search query. I was hoping the following would work, however it seems lambda expressions do not work within a Where clause of a LinqDataSource (in VB):
No property or field 'op' exists in type 'orderProduct' Any clues as to how to get this working within the LinqDataSource definition, or will I have to handle and set up a custom OnSelecting event?
I am binding a GridView with LinqDataSource with AutoDelete functionality enabled. GridView is bound to the Products Table. I have a Products Table and a Category Table with an association on CategoryID. If I try to delete a Category that is referred in the Products Table I cannot do that. Its is totally acceptable, but I want the end user to be notified with some error message. Where to catch this error message?