What is the efficient way to make a gridview from 2 tables (one of them is using the primary key of the other as a foreign key) using visual studio 2005?
thanks
Nested gridview (or datalist/repeater) is what you need. You need to create TemplateField in parent GridView to add another Gridview in it. Handle the RowDataBound event of parent gridview to bind its child elements/controls.
PS: You may read MSDN pages/tutorial about GridView and its events.
MSDN Link : Walkthrough: Creating a Nested GridView Control
Related
How to bind more than one gridview on single asp.net page,with edit, update and pagination. Must work independendly.
in ASP.NET 3.5 web page, a GridView control can have both SqlDataSource and code-behind datasource (with a DataTable for example)?
Both datasource are equal (the same stored procedure).
Thanks a lot.
Luis
It is possible only under one condition.That you set the DataSourceID to nothing of your gridview before re-assigning its datasource to a datatable.Otherwise visual Studio will scream loudly at you in these lines
'Both DataSource and DataSourceID are defined on 'yourGrid'. Remove one definition.'
yourgrid.DataSourceID=null;
yourGrid.DataSource=yourDataTable;
I have multiple TabPanels with one GridView each. I successfully used the GUI to set the datasource for each GridView. After adding the latest TabPanel and GridView I created the datasource and finished, but it didn't create any datasource. The datasource dropdownlist in GridView is empty. There are no errors, it just doesn't do anything when I click "finish". Now I can't create a new datasource for any new GridView on any tab. Existing GridViews and datasources work fine. What could cause this?
May be u did copy & paste your code, Or any panel, VS give unique name to sqldatasource always.
I am using a gridview in my form.aspx page. The textboxes in each row of the gridview are to be populated from a datagrid upon clicking a particular field of the datagrid. Is there any way to do the same.....?
Did you check out some of the samples the ASP.NET website? Maybe this one can help?
Gridview quickstart on ASP.NET
Otherwise I suggest you describe your problem in greater details. What's the datasource? Anything specific you can't figure out right now? Are you getting any exceptions?
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.