hi,
i need help with this codings. i did this in visual web developer.it is based on jscript and i need to convert it into asp.net.please help.
<%@ Page Language="JScript" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Register TagPrefix="Header" TagName="ImageHeader" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<script language="jscript" runat="server">
function Page_Load(Sender:Object,events:EventArgs)
{
if(!ISPostBack)
{
var dataBaseConnection:OleDbConnection = new
OleDbConnection(ConfigurationSettings.AppSettings("Connectionstring"));
var queryString: System.String =
"Select lastName,firstName from authors";
dataBaseConnection.Open();
var dataBaseCommand : OleDbCommand=
new OleDbCommand(queryString, dataBaseConnection);
var dataReader = dataBaseCommand.ExecuteReader();
while(dataReader.Read())
nameList.Items.Add(dataReader.GetString(0) +
", " + dataReader.GetString(1'));
dataBaseconnection.Close();
}
else
{
dataGrid.DataSource = Getdata();
dataGrid.DataBind();
}
}
function GetData() : ICollection
{
var set : DataSet = new DataSet();
var dataSetConnection: OleDbConnection = new
OleDbConnection(ConfigurationSettings.AppSettings(
"ConnectionString"));
var authorID :int= nameList.SelectedIndex + 1;
var queryString : String =
"Select Titles.Title,Titles.ISBN, " +
"Publishers.PublisherName from AuthorISBN " +
"Inner join Titles On AuthorISBN.ISBN = " +
"Titles.ISBN, Publishers WHERE " +
"(AuthorISBN.AuthorID = " + authorID + ")";
var dataBaseCommand : OleDbCommand =
new OleDbCommand(queryString,dataBaseConnection);
var dataAdapter : OleDbDataAdapter =
new OleDbDataAdapter(dataBaseCommand);
dataAdapter.Fill(set);
dataBaseCommand.Connection.Close();
var dataView : dataView = new dataView(set.Tables[0]);
dataView.Sort = "Title";
return dataView;
}
</script>
<form id="form1" runat="server">
<Header:ImageHeader id="Head" runat="server">
</Header:ImageHeader>
Authors
<asp:DropDownList ID="nameList" runat="server">
</asp:DropDownList>
<asp:Button ID="Button" runat="server" Text="Select" />
<asp:DataGrid ID="dataGrid" runat="server">
</asp:DataGrid>
<div>
</div>
</form>
</body>
</html>