Click here to Skip to main content
16,010,022 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: website page display Pin
StianSandberg14-Jan-07 21:42
StianSandberg14-Jan-07 21:42 
QuestionUrgent!!! Validationcontrols not working Pin
Ramya SM14-Jan-07 20:11
Ramya SM14-Jan-07 20:11 
QuestionASP software security Pin
Haun the 2nd14-Jan-07 12:37
Haun the 2nd14-Jan-07 12:37 
AnswerRe: ASP software security Pin
Guffa14-Jan-07 13:04
Guffa14-Jan-07 13:04 
GeneralRe: ASP software security Pin
Haun the 2nd14-Jan-07 14:06
Haun the 2nd14-Jan-07 14:06 
AnswerRe: ASP software security Pin
Christian Graus14-Jan-07 16:05
protectorChristian Graus14-Jan-07 16:05 
AnswerRe: ASP software security Pin
Vasudevan Deepak Kumar14-Jan-07 17:04
Vasudevan Deepak Kumar14-Jan-07 17:04 
QuestionCreating a Web Interface in ASP.NET using C# Pin
koonda00714-Jan-07 9:33
koonda00714-Jan-07 9:33 
Hi guys,

I have a database in SQL Server and I wanted to create a web interface in C#. I have 3 Listbox controls and a Textbox and two buttons for this. What I want to do is to select values from 3 Listbox controls and input some text in the textbox i.e year to display information on another page including all the information from listboxes too. I have no idea how to program this part. I have populated the 3 Listboxes from the database tables and I want to select some values from these listboxes and display information on another page. Could somebody help me in this regard. Below is the code I developed so far.

protected void Page_Load(object sender, EventArgs e)
{
// create the connection string and command string

string connectionString = "Server=.\\SQLEXPRESS;Database=NorthWind;Integrated Security=SSPI;";



string commandString = "Select * from Customers";
string commandString1 = "Select * from Orders";
string commandString2 = "Select * from Employees";
//pass the strings to the sql data adapter constructor

SqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, connectionString);
SqlDataAdapter dataAdapter1 = new SqlDataAdapter(commandString1, connectionString);
SqlDataAdapter dataAdapter2 = new SqlDataAdapter(commandString2, connectionString);
SqlDataAdapter dataAdapter3 = new SqlDataAdapter(commandString2, connectionString);

// create a data set

DataSet dataSet = new DataSet();
// fill the dataset object

dataAdapter.Fill(dataSet, "Customers");
dataAdapter1.Fill(dataSet, "Orders");
dataAdapter2.Fill(dataSet, "Employees");
dataAdapter3.Fill(dataSet, "Products");






// for loop for customer table

foreach (DataRow dtrow in dataSet.Tables["Customers"].Rows)
{
ListBoxCustomers.Items.Add(dtrow["CustomerID"].ToString());
ListBoxCustomers.Items.Add(dtrow["City"].ToString());
ListBoxCustomers.Items.Add(dtrow["CompanyName"].ToString());
ListBoxCustomers.Items.Add(dtrow["ContactName"].ToString());
}


// for loop for Employees table

foreach (DataRow dtrow in dataSet.Tables["Employees"].Rows)
{
ListBoxEmployees.Items.Add(dtrow["EmployeeID"].ToString());
ListBoxEmployees.Items.Add(dtrow["LastName"].ToString());
ListBoxEmployees.Items.Add(dtrow["FirstName"].ToString());

}

// for loop for order table


foreach (DataRow dtrow in dataSet.Tables["Orders"].Rows)
{
ListBoxOrders.Items.Add(dtrow["OrderID"].ToString());
ListBoxOrders.Items.Add(dtrow["CustomerID"].ToString());
ListBoxOrders.Items.Add(dtrow["EmployeeID"].ToString());

}

And here is the Event Handler which I want to select values from the listboxes and a textbox and redirect the user to display relevant information on another page. Unfortunately I don't know how to code this part.

protected void BtnSubmit_Click(object sender, EventArgs e)
{

Response.Redirect("Default2.aspx"); // another page to display

}


I appreciate your help.



Koonda

AnswerRe: Creating a Web Interface in ASP.NET using C# Pin
Christian Graus14-Jan-07 16:06
protectorChristian Graus14-Jan-07 16:06 
GeneralRe: Creating a Web Interface in ASP.NET using C# Pin
koonda00715-Jan-07 6:48
koonda00715-Jan-07 6:48 
GeneralRe: Creating a Web Interface in ASP.NET using C# Pin
Christian Graus15-Jan-07 8:50
protectorChristian Graus15-Jan-07 8:50 
QuestionImage Button Pin
ADY00714-Jan-07 8:54
ADY00714-Jan-07 8:54 
AnswerRe: Image Button Pin
Christian Graus14-Jan-07 16:07
protectorChristian Graus14-Jan-07 16:07 
Questionhow to set page in its initial form after save button Pin
mohd imran abdul aziz13-Jan-07 17:51
mohd imran abdul aziz13-Jan-07 17:51 
AnswerRe: how to set page in its initial form after save button Pin
simsen13-Jan-07 20:50
simsen13-Jan-07 20:50 
Questionusing CSS programatically Pin
Tina P13-Jan-07 17:12
Tina P13-Jan-07 17:12 
AnswerRe: using CSS programatically Pin
Elina Blank14-Jan-07 10:19
sitebuilderElina Blank14-Jan-07 10:19 
AnswerRe: using CSS programatically [modified] Pin
sams781014-Jan-07 14:59
sams781014-Jan-07 14:59 
QuestionCLASS Project in VS 2005 Pin
Amit Kumar G13-Jan-07 12:04
Amit Kumar G13-Jan-07 12:04 
AnswerRe: CLASS Project in VS 2005 Pin
Guffa13-Jan-07 12:25
Guffa13-Jan-07 12:25 
GeneralRe: CLASS Project in VS 2005 Pin
Amit Kumar G13-Jan-07 12:30
Amit Kumar G13-Jan-07 12:30 
GeneralRe: CLASS Project in VS 2005 Pin
Christian Graus13-Jan-07 15:57
protectorChristian Graus13-Jan-07 15:57 
AnswerRe: CLASS Project in VS 2005 Pin
Colin Angus Mackay14-Jan-07 11:00
Colin Angus Mackay14-Jan-07 11:00 
QuestionTree menu with expand/collapse function Pin
simsen13-Jan-07 8:39
simsen13-Jan-07 8:39 
AnswerRe: Tree menu with expand/collapse function Pin
Amit Kumar G13-Jan-07 12:35
Amit Kumar G13-Jan-07 12:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.