I have my Items table bound to the repeater control. What if I want to display data from another table that is related to this one?
I'm using LINQ to SQL as the datasource in the codebehind.
In the repeater itemDataBound event get any data you need with LINQ and display what you need.
Related
In a form there's datasource, the datasource content is a table. this table is the datasource of a grid. then I have markChange override method on the table to do business logic when I'm selecting record/s on the grid.
Now the question is, if my form datasource is a Query how could I do the markChange event?
If you add a query to your datasources node of your form it should expand with all the tables in the query.
On the first table you can just override the markChanged method and it will be triggered when you select a record using the checkbox.
The markChanged is triggered on the first table though, not on the others.
Is there a control I can just drop on a page, and link it to a sql server table that will then list all the rows in the table and let me edit any of the columns?
Also the ability to add, delete rows.
You can use asp.net dynamic data, it generates a CRUD interface for your tables.
read more
http://www.asp.net/web-forms/videos/aspnet-dynamic-data/getting-started-with-dynamic-data
http://msdn.microsoft.com/en-us/library/ee845452(v=vs.100).aspx
Have a look at the SqlDataSource control. You can set the connection via ConnectionString property, and also utilize the DeleteCommand and InsertCommand properties.
Using a GridView, you can then set the DataSourceID to the ID of your SqlDataSource
ASP.NET newbie here. I would like to create a form with multiple types of controls for inserting a single record into a database table. This record has a "Type" field which is a foreign key, and I would like to populate a combobox with the possible values for it. I tried drag'n'dropping the table in design view (like in windows forms), but it always generates a gridview. How can I make it generate a form where I can specify the types of controls?
Thanks in advance
you could check detailsview and formview control.
http://quickstart.developerfusion.co.uk/QuickStart/aspnet/doc/ctrlref/data/detailsview.aspx
http://quickstart.developerfusion.co.uk/QuickStart/aspnet/doc/ctrlref/data/formview.aspx
Sounds like you either want to use a DetailsView or a FormView control.
I'm using linqdatasource for displaying data in listview (nested because of grouping) control. I want to display data from more than one table.
I'm using VWDExpress.
I have implemented this solution using nested datalist controls.
I am trying to bind a datatable to a repeater. To do this, according to a code sample, I need to call dataview() when choosing the datasource property of the repeater and then write databind().
When I do this, I still get the exception that the source to databind to is not derived from IDatasourceControl.
What is the correct way to bind a datatable to a repeater? I want each record to repeat itself in the repeater (obviously).
I have seen this link (http://blogs.x2line.com/al/archive/2008/06/21/3469.aspx). What exactly does Container.Dateitem in the expression on the ASPX page mean?
Thanks
With a repeater you should be able to just do the following:
rpYourRepeater.DataSource = dtYourDataTable;
rpYourRepeater.DataBind();
That's it.
Just verify that your DataSourceID is tied to a real field in your datatable or just leave the DataSourceID out completely as you don't really need it depending on what you are doing.
You don't need any of that dataview stuff unless you want to start putting filters on your data.
I'm guessing that you are attempting to bind to DataSourceID. You should bind to DataSource in your repeater.