Hi,
public partial class Staff_LeaveNew : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
}
protected void DropDownList1_S electedIndexCha nged(object sender, EventArgs e)
{
if (DropDownList1. SelectedValue == "Death Leave")
{
Response.Redire ct("/Staff/nDeathLeave.asp x?staff_id=" + Request.QuerySt ring["staff_id"]);
}
else if (DropDownList1. SelectedValue == "Holiday Leave")
{
Response.Redire ct("/Staff/nHolidayLeave.a spx?staff_id=" + Request.QuerySt ring["staff_id"]);
}
else if (DropDownList1. SelectedValue == "Maternity Leave")
{
Response.Redire ct("/Staff/nMaternityLeave .aspx?staff_id= " + Request.QuerySt ring["staff_id"]);
}
else if (DropDownList1. SelectedValue == "Replacemen t Leave")
{
Response.Redire ct("/Staff/nReplacementLea ve.aspx?staff_i d=" + Request.QuerySt ring["staff_id"]);
}
else if (DropDownList1. SelectedValue == "Wife Maternity Leave")
{
Response.Redire ct("/Staff/nWMaternityLeav e.aspx?staff_id =" + Request.QuerySt ring["staff_id"]);
}
else
{
Response.Redire ct("LeaveNew.as px?staff_id=" + Request.QuerySt ring["staff_id"]);
}
}
Plz help. Thanks.
Karen
2 10511
Hi karenkksh
Can u tell us wht is problem exactly,
did u set Autopostback =true property of dropdown box.
Hi,
public partial class Staff_LeaveNew : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
}
protected void DropDownList1_S electedIndexCha nged(object sender, EventArgs e)
{
if (DropDownList1. SelectedValue == "Death Leave")
{
Response.Redire ct("/Staff/nDeathLeave.asp x?staff_id=" + Request.QuerySt ring["staff_id"]);
}
else if (DropDownList1. SelectedValue == "Holiday Leave")
{
Response.Redire ct("/Staff/nHolidayLeave.a spx?staff_id=" + Request.QuerySt ring["staff_id"]);
}
else if (DropDownList1. SelectedValue == "Maternity Leave")
{
Response.Redire ct("/Staff/nMaternityLeave .aspx?staff_id= " + Request.QuerySt ring["staff_id"]);
}
else if (DropDownList1. SelectedValue == "Replacemen t Leave")
{
Response.Redire ct("/Staff/nReplacementLea ve.aspx?staff_i d=" + Request.QuerySt ring["staff_id"]);
}
else if (DropDownList1. SelectedValue == "Wife Maternity Leave")
{
Response.Redire ct("/Staff/nWMaternityLeav e.aspx?staff_id =" + Request.QuerySt ring["staff_id"]);
}
else
{
Response.Redire ct("LeaveNew.as px?staff_id=" + Request.QuerySt ring["staff_id"]);
}
}
Plz help. Thanks.
Karen
The code seems to be free from bugs, so I think u have not set teh Autopostback property(as the other person has mentioned).
One more thing for situatios like this where u check a single value in multiple statements, Its better to use Switch than using If Else Statements,
It will boost the performance.as in if statements all the conditions are checked even if the 1st one is correct.
Think of this, U have nearly 100 conditions and only one will be true,in "If else" all the conditions will be checked even if the 1st is true, which is waste,
In Switch its not the case, if a condition is true, it will not check for the remaining.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Filiz Duman |
last post by:
I was just wondering, is it possible to write into the drop down box in
order to jump to a specific item. The reason why I am asking is my drop down
box has many items and additionally to the scrolling down, it would be good
if the user can write into the box in order to get the specific entry the
list selected.
Is this possible ?
Thanks.
|
by: Yoshitha |
last post by:
hi
I have 2 drop down lists in my application.1st list ontains itmes like
java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the
items like 50,60,70,80,90,100.
i will select any skill in 1st drop down list then i'll select % of this
skill in the 2nd list box , based on the percentage i've selected in the 2nd
list box it has to display
2 sets of drop down list boxes at run time one for selecting skill and
|
by: Dica |
last post by:
i want to set up my aspx page with a hierarchical navigation system. first
the user has to select to "-- Select An Action --", which could be either
"Add Item" or "Edit Item". If the user selects "Edit Item", i show a list of
items they can select. once selected, i show the input form, which has all
the item details. conversely, if the user selects "Add Items", i skip
showing the "Select Item" drop down and go straight to showing the item...
|
by: Ben Fidge |
last post by:
Hi
I've got a situation where I need to direct a Response.Redirect to a new
window from within a page embedded within an IFrame.
Currently, we have a page embedded within an IFrame that presents a list of
items to the user in a drop-down list. According the the item selected, one
of two things can happen when they click on a button next to the drop-down:
a) The user is redirected to another page, which is itself displayed inside
|
by: =?Utf-8?B?d2ViZ3V5QGNvbW11bml0eS5ub3NwYW0=?= |
last post by:
We have been running into some problems where using Response.Redirect causes
the page to hang and it never actually redirects.
Here's the scenario:
User opens the page, selects an item from the drop down list and then clicks
one of a couple of buttons to send them off to another page. We do a little
bit of validation in the Event Handler and then do a Response.Redirect off to
the next page. Then the page just sits there and never...
| |
by: mrjoka |
last post by:
hi guys,
i'm building a web site where i have a lot of pages, in the default page i'm having a menu in this menu i have a callendar a drop down list, in the callendar i need to remember the date selected by the user and for the drop down list i have to remember the value selected by the user, these values i need them to query the database.the first time it works great the selected item in the drop down list can be read by any other page(in...
|
by: SQLjunky |
last post by:
Hello,
Contrary to what my screen name indicates, i'm actually quite new to SQL.
Having said that, I'll get right into my problem.
I'm trying to query an mssql database to return to the value that the user inputs through a drop-down menu in the databases GUI front-end (bugzilla actually). For example, a product is selected in a drop-down menu, and, depending on the product chosen, a second drop-down menu becomes active, containing a list...
|
by: ajos |
last post by:
Hello all,
Im making a dependent drop down for my application for filtering purpose. I have populated the drop down from the database and retrieved in the html.
<tr>
<td valign="top" width="138" height="26"><small><font face="Verdana"><strong>Branch</strong></font></small></td>
<td width="379" height="26">
<select name="branch" size="1" onChange="messValue()">
<option value="">(select branch)</option>
<%
...
|
by: student2008 |
last post by:
Sorry about the title its a tricky one.
I have a form which allows me to add a question and answers into a mysql database via a combination of, if a certain option is chosen and the reset button is pressed then a text box appears to enter a new question or answer or both. the newly entered data is then inserted into mysql. The newly entered data is then requested by mysql_fetch_array() to be displayed as options in the drop down list.
If...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |