How do I post post SQL data using submit button in asp.net c# razor

Sax

New Member
Thanks in advance.Can anyone please help me get this button working so I can display a row from the Northwind database 'only' when the button is clicked.I have been doing webgrid tutorials; however, in each tutorial the grid/ webgrid is always showing before it is searched.It would be great if I could learn how to use a button to show data from a row in the Northwind database in a list/label/table or grid 'only' when a form is submitted.Keeping it simple, I have this:\[code\]@{ Layout = "~/_Layout.cshtml"; Page.Title = "Compare"; var db = Database.Open("Northwind"); var selectedData = http://stackoverflow.com/questions/15713250/db.Query("SELECT * FROM Products");<h1>Products</h1> <form action="" method="post"> <div> <input type="Submit" value="http://stackoverflow.com/questions/15713250/Get Products" /><br/> <br/> </div> </form> <ol> @foreach(var row in selectedData) { <li><a href="http://stackoverflow.com/questions/15713250/#">@row.ProductName</a></li> } </ol> }\[/code\]Thanks everyone.
 
Back
Top