Professional ASP.NET 1.0 Special Edition- P2

Professional Special Edition- P2:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | Nothing particularly challenging here and when the button is pressed the grid fills with authors from the selected state Again nothing that couldn t be achieved with ASP but let s look at the page code starting with the controls form runat server State asp DropDownList id state runat server asp Button Text Show Authors OnClick ShowAuthors runat server p asp DataGrid id DataGrid1 runat server form Here we have a form marked with the runat server attribute. This tells that the form will be posting back data for use in server code. Within the form there is a DropDownList the equivalent of an HTML SELECT list to contain the states a Button equivalent of an HTML INPUT type button to postback the data and a DataGrid to display the authors. The button uses the OnClick event to identify the name of the server-side code to run when the button is pressed. Don t get confused by thinking this is the client-side DHTML onClick event because it s not. The control is a server-side control runat server and therefore the event will be acted upon within server-side code. Now let s look at the remaining code starting with the Import statement. This tells that we are going to use some data access code in this case code specific to SQL Server. @ Import Namespace Next comes the actual code written in Visual Basic. script language VB runat server Here is the first real introduction to the event architecture. When a page is loaded the Page_Load event is raised and any code within the event procedure is run. In our case we want to fill the DropDownList with a list of states so we just manually add them to the list. In reality this data would probably come from a database. Sub Page_Load Sender As Object E As EventArgs If Not Then CA IN KS MD MI OR TN UT End If End Sub One thing to note about this code is that it

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.