Take 3x1 table Write available categories
Drag & drop DropDownList
Drag & drop Grid View Control & set width Autoformat
Drag & drop LINQDataSource & set width Autoformat
Select LINQDataSource task & configure Database
Category Id
Category Name
For DropDown List: Choose DataSource: LINQDataSource
Category Name
For dropdown list: ddl available
AutoPostball: true
Double click on the Dropdown list
NorthWind DBDataContext dc = new NorthWindDBDataContext ();
Int cid = int.Parse (ddlCategories.SelectedItem.Value;
Var products = from product in dc.Products
Where
Product.Category Id = cid
Select new
?
Product.Product Id,
Product.ProductName,
Product = QuantityPerUnit,
Product.UnitPrice
};
GridView1.DataSource = Products;
GridView1.DataBind ();
Click on GridView tasks Edit columns à Uncheck auto-generate fields
Select BoundField
Click Add
Header Text: Product ID
DataFile ID: Product ID
Select HyperLink Field
Add HeaderText: ProductName
DataNavigateURI Fields: Product ID
DataNavigateURIFormatString: Showorders by Id.aspx ? pid = {0}
DataTextField: Product Name
Select Bound field
Add Header Text: Quanity
DataField: Quanity per unit
Unit Price
Website (menu) – Add New Webform
Name: ShowOrdersby Id take 3x1 table
Select LINQ Data Source tab Table: Order_details
Inclined to build a profession as VB.Net Developer? Then here is the blog post on, explore VB.Net Training
ChooseDataSource: LINQDataSource
Click on edit columns
Command Field select add
Button Type: buttonSelect Text: Show Customer
OK
The data from Grid View can be read from 3 different event handles.
Grid View name.Selected Row
To refer the Grid View Row from the events of Grid View other than Selected Index Changed;
e.Row (where “e” is a Grid View Row Event Args variable)
Note:
Data within the Grid View Row will exist within the table cell of Grid View Row or within some control present within the table cell of Grid View Row.
(Table cell) Grid View Row. Cells [cell index]
To read the value from the control present within the Table cell of GridViewRow
(Control Type) GridViewRow. Cells [cellindex]. Controls [Control index]
(Or)
(Control Type) GridViewRow. Cells [cellindex]. Find Control [Control Name]
If we check 101 and list delete it must be deleted (Check Box)
Gvl.Rows[0].Cells [0].Find Control (chkOrderId)
NorthWindDBDataContext dc = new NorthWindDBDataContext ();
Table oid = (Tablecell) GridView1.SelectedRow.Cells [0];
Int OrderId = int Parse (oid.Text)
Var cinfo = from customer in
dc.Orders where customer.OrderID = = OrderID
Select new
{
Customer.Customer.CompanyName,
Customer.Customer.ContextName,
Customer.Customer.CustomerID,
Customer.Customer.Country
} ;
GridView2.DataSource = cinfo;
GridView2.DataBind ();
Execute
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.