|
Plain vanilla ASP on IIS 4.0 did have security threats from CodeRed and NIMDA. However, subsequent ServicePacks and patches from Microsoft have filled the gap sufficiently.
It is upto the web administrator to suitably firewall the webserver and apply enough judicious security precautions.
|
|
|
|
|
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
|
|
|
|
|
This is the wrong way to do it. Use a datagrid or a grid view, and assign your datatable as a datasource to the control, then call databind. It will do this iterating for you.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks Christian Graus,
I just wanted to develop it in a programming way, but anyways the GridView is also a good idea so I will go ahead and use GridView.
Thanks
Koonda
|
|
|
|
|
koonda007 wrote:
I just wanted to develop it in a programming way,
You should always try to do stuff the *right* way, which usually means, the easiest way.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi, how can i open a new window (not same window!!) from an ImageButton using asp.net??
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
target="_blank" in the button attributes. ASP.NET will ignore it, as it's not a server tag, and it will be passed through as is.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Dear All,
i am bit new to the dotnet world. i am making web application using asp.net ,C# (Visual studio 2005).
i want to how can i make page to reappear as page was loaded very first time after saving all the record(controls content) on save button.
i have page with seven controls (some of them autopostback). and there is save button. so i basically trying for as soon as save button complete its command, i clear all controls values. so as page reappear in its initial stag.
HOw can i do it . please help me
thanks
regards
imran khan
|
|
|
|
|
Hi imran khan,
The controls are they empty when you are loading the page first time?
If so, you can either after you have saved into data/xml-file in your save buttons click event set the controls value to an empty string as:
test.text = "";
or you can make a function where you make all the controls emty, an example:
private void emptyControls()
{
LabelTest.text = "";
TextTest2. = "";
}
Now call the function in the save buttons click:
emptyControls();
If you gets input to the controls in your page load, from a database/xml-file you have to do same in the save button click event. I here suggest that you make a function and then call it both places.
Kind regards,
simsen
|
|
|
|
|
Hey guys, I was wondering how do I change the settings of a webpage programatically if the page is using an external styles sheet (lets say styles.css).
If I would like to...lets say change the background color in the load event of the page or perhaps the button click event...right now I'm doing that in the html mode by assigning the value directly to the inline style element.
But I'll be creating external style sheets, and would like to grab the values from their programatically in code behind.
Can some one point me to the right direction??
Thanks
~TINA
|
|
|
|
|
In all WebControls you have the property CssClass.
You can set it dynamically in your server-side code.
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
include the style.css file into the aspx
and
private void Button1_Click(object sender, System.EventArgs e)
{
this.TextBox1.CssClass="myclass1";
}
It is cool
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
-- modified at 21:06 Sunday 14th January, 2007
|
|
|
|
|
Hi Guys
How i can add CLASS projects into my Solution Files. I am using VS 2005 Express. Evertime i can see only two options
a) Add new site
b) Add exisitng web site...
Please Advice.
Thx
|
|
|
|
|
File -> Add -> New project
---
Year happy = new Year(2007);
|
|
|
|
|
Nope
only two options for adding new or exisiting web site...Please suggest....
Is it not a feature from 2005 Express version?
|
|
|
|
|
The express editions are limited, yes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Amit Kumar G wrote: I am using VS 2005 Express
You will have to be more specific. There are several Express Editions of Visual Studio. They can be installed side by side.
I just started Microsoft Visual C# 2005 Express Edition. In the File menu the first option is "New Project". The dialog gives the option of "Class Library".
|
|
|
|
|
Hi,
I'm a newbee into asp.net programming....
I want to develope a menu into my website that has the tree structure (without anything else than the text no -+ and so on) like this:
Menu1
Menu1.1
Menu1.2
Menu2
Menu2.1
Menu3
Menu3.1
Menu3.2
Menu3.3
and so on.......
Where the submenus expand/colapse when I click on the Menu1/2/3.
I want it to dynamic with an access database I've created this way:
MenuId MenuChild MenuName Link
1 0 Menu1 menu1.aspx
2 1 Menu1.1 menu1-1.aspx
3 1 Menu1.2 menu1-2.aspx
4 0 Menu2 menu2.apx
and so on
Can anybody help me to link to an tutorial where I can learn how to program the above in asp.net with C#... And I use an access database - but I'm able to also to use an MSSql database (the database is not my problem)
Kind regards
simsen
|
|
|
|
|
r y using 2 or 1.1 ...If 1.1 then use java scripts otherwise 10 min job from 2.0...Please confirm which version u r using and i will try to help you more....
Amit Gugnani
|
|
|
|
|
Hi Amit,
I'm using 2.0....
I know there is an treeview in 2.0, but the treeview there has the +/- before the text. And I don't want the +/- I only want text. If there is one or more sub menu's it shouldn't link but expand (and when it is expanded and I hit on the text again it should collapse)
Kind regards,
simsen
|
|
|
|
|
hi Friends,
i am working on ASP. i just updating my skills ASP to ASP.NET (using MSDN, and some other sites). some one asked me what is ASP.NET Layout? i googled for ASP.NET Layout, but found different concepts on this ASP.NET Layout.
please can anyone give me the idea about this ASP.NET Layout?
thanks in advance,
Suketh
|
|
|
|
|
hi, i'm a newbie to all of this,
anyway, i've created a asp.net site in VS2005.
compiling it in VS2005 runs perfectly fine,
now i'm trying to publish it onto a local IIS,
after publishing it, the login page loads fine, but no matter
what details i type in, the login control says the i cannot be logged in.
first i thought the published site may not have the correct ASPNETDB.MDF
file, so i copied the working one, into the InetPub folder manually,
but it still gives me the same problem,
I don't know if it's having trouble accessing the database,
or what,
Pls Help
Thanx
|
|
|
|
|
Hi,
in AciveStepChanged event i need to validate user data in Specific step ( by code not using validation controles ) if this validation is not passed the user getting stuck in that step and not move to next step unless validation pass
How i keep user in Specific step if validation not pass?
thanks
|
|
|
|
|
Yes i got it
protected void Wizard1_NextButtonClick(object sender,
WizardNavigationEventArgs e)
{
if(Wizard1.ActiveStepIndex == 0)
{
// validation logic
if ( ...... )
{
e.Cancel = true;
}
}
}
thakns
|
|
|
|
|
Hi All,
I m working on a shoping card. When some one Click on Order Now Button it goes to World Pay (Credit Card Bank) Pages. There is a Form which I submit with Javascript like this document.frmworld.submit(). Now the problem is that it works fine in IE, But does not work on Fire fox.
Can Any one Help me.
Thanks in Advance.
|
|
|
|