|
 |
 |
This tutorial will show you how to use a GridView control in combination with a DetailsView control in ASP.NET and VB.Net 2.0 to display master-detail information.
To refresh the GridView control after a new record is inserted into DetailsView control
Sub CustomerDetail_ItemInserted(ByVal sender As Object, _
ByVal e As DetailsViewInsertedEventArgs)
CustomersView.DataBind()
End Sub
|
We moved our web sites to Server Intellect and have found them to be incredibly professional. Their setup is very easy and we were up and running in no time.
Insert the values entered
Sub CustomerDetail_ItemUpdating(ByVal sender As Object, _
ByVal e As DetailsViewUpdateEventArgs)
For i As Integer = 0 To e.NewValues.Count - 1
If e.NewValues(i) IsNot Nothing Then
e.NewValues(i) = Server.HtmlEncode(e.NewValues(i).ToString())
End If
Next
End Sub
|
I just signed up at Server Intellect and couldn't be more pleased with my Windows Server! Check it out and see for yourself.
DataSource setting
<asp:SqlDataSource ID="Customers" runat="server"
ConnectionString=
"<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID]
FROM [Customers]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="Details"
ConnectionString=
"<%$ ConnectionStrings:NorthwindConnectionString %>"
runat="server"
SelectCommand="SELECT * FROM [Customers]
WHERE ([CustomerID] = @CustomerID)"
InsertCommand="INSERT INTO [Customers] ([CustomerID],
[CompanyName], [ContactName], [ContactTitle], [Address],
[City], [Region], [PostalCode], [Country], [Phone], [Fax])
VALUES (@CustomerID, @CompanyName, @ContactName, @ContactTitle,
@Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax)"
UpdateCommand="UPDATE [Customers] SET [CompanyName] = @CompanyName,
[ContactName] = @ContactName, [ContactTitle] = @ContactTitle,
[Address] = @Address, [City] = @City, [Region] = @Region,
[PostalCode] = @PostalCode, [Country] = @Country,
[Phone] = @Phone, [Fax] = @Fax
WHERE [CustomerID] = @CustomerID">
|
Looking for the C#.NET 2005 Version? Click Here!
Looking for more ASP.NET Tutorials? Click Here!
|
|
|