Click here to Skip to main content
15,892,480 members
Home / Discussions / C#
   

C#

 
GeneralUpdating a database Pin
kornstyle21-Mar-05 8:42
kornstyle21-Mar-05 8:42 
GeneralRe: Updating a database Pin
Dave Kreskowiak21-Mar-05 11:16
mveDave Kreskowiak21-Mar-05 11:16 
Generalempty textBoxes Pin
xrado21-Mar-05 6:41
xrado21-Mar-05 6:41 
GeneralRe: empty textBoxes Pin
techieboi21-Mar-05 6:58
techieboi21-Mar-05 6:58 
GeneralRe: empty textBoxes Pin
xrado21-Mar-05 19:24
xrado21-Mar-05 19:24 
GeneralC# Windows Forms App : 2 Exe Files Pin
rt721-Mar-05 6:38
rt721-Mar-05 6:38 
GeneralRe: C# Windows Forms App : 2 Exe Files Pin
Dave Kreskowiak21-Mar-05 8:36
mveDave Kreskowiak21-Mar-05 8:36 
Generalasp.net selected broken Pin
Joshua Lunsford21-Mar-05 6:09
Joshua Lunsford21-Mar-05 6:09 
I thought I was going crazy or just a really bad programmer but its my server(localhost). Every time I try and use a dropdownbox or listbox to select a value and use it, it always uses the '0' index of the select box on post back. I tried running the Microsoft example of selected value and i get the same result... on the MS example... when i hit submit it always returns 1 no matter what i hit... anyone know what my problem is... here is the example straight from the MSDN library..


<code>

<!-- The following example demonstrates how to select items in a TextBox.
If the item is found in the text box, the item is selected and a message is
displayed stating the name of the selected item. If the item is not found,
no item is selected and a message is displayed stating that the item was not
found. -->

<%@ Page Language="C#" AutoEventWireup="True" %>

<html>

<head>

<script runat="server">

void Button_Click(Object sender, EventArgs e)
{

// Perform this operation in a try-catch block in case the item is not found.
try
{
List.SelectedValue = ItemTextBox.Text;
MessageLabel.Text = "You selected " + List.SelectedValue + ".";
}
catch (Exception ex)
{
List.SelectedValue = null;
MessageLabel.Text = "Item not found in ListBox control.";
}

}

</script>

</head>

<body>

<form runat="server">

<h3> ListControl SelectedValue Example </h3>

<asp:ListBox ID="List"
runat="server">

<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>

</asp:ListBox>

<hr>

Enter the value of the item to select: <br>
<asp:TextBox ID="ItemTextBox"
MaxLength="6"
Text="Item 1"
runat="server"/>

&nbsp;&nbsp;

<asp:Button ID="SelectButton"
Text="Select Item"
OnClick="Button_Click"
runat="server"/>

<br><br>

<asp:Label ID="MessageLabel"
runat="server"/>

</form>

</body>
</html>
</code>
GeneralRe: asp.net selected broken Pin
Joshua Lunsford21-Mar-05 8:33
Joshua Lunsford21-Mar-05 8:33 
GeneralRe: asp.net selected broken Pin
leppie21-Mar-05 8:39
leppie21-Mar-05 8:39 
GeneralCheap RegExpression Question Pin
matthias s.21-Mar-05 5:25
matthias s.21-Mar-05 5:25 
GeneralRe: Cheap RegExpression Question Pin
leppie21-Mar-05 5:42
leppie21-Mar-05 5:42 
QuestionHow to make a blinking notify icon Pin
saarkk21-Mar-05 5:09
saarkk21-Mar-05 5:09 
AnswerRe: How to make a blinking notify icon Pin
leppie21-Mar-05 5:47
leppie21-Mar-05 5:47 
General.net compact framework using File stream problem Pin
Rene Xavier21-Mar-05 4:57
Rene Xavier21-Mar-05 4:57 
General:validating against NT Sam and Active Directory Pin
Ordina21-Mar-05 4:16
Ordina21-Mar-05 4:16 
Generalweb service (Resource cannot be found) Pin
steve_rm21-Mar-05 4:03
steve_rm21-Mar-05 4:03 
GeneralRe: web service (Resource cannot be found) Pin
leppie21-Mar-05 5:51
leppie21-Mar-05 5:51 
Generaldrawing bitmap Pin
ee9903521-Mar-05 3:37
ee9903521-Mar-05 3:37 
GeneralRe: drawing bitmap Pin
Judah Gabriel Himango21-Mar-05 4:55
sponsorJudah Gabriel Himango21-Mar-05 4:55 
GeneralSave an object in sqlserver Pin
machocr21-Mar-05 3:29
machocr21-Mar-05 3:29 
GeneralRe: Save an object in sqlserver Pin
Judah Gabriel Himango21-Mar-05 4:59
sponsorJudah Gabriel Himango21-Mar-05 4:59 
GeneralRe: Save an object in sqlserver Pin
machocr21-Mar-05 8:27
machocr21-Mar-05 8:27 
GeneralRe: Save an object in sqlserver Pin
Judah Gabriel Himango21-Mar-05 8:37
sponsorJudah Gabriel Himango21-Mar-05 8:37 
GeneralRe: Save an object in sqlserver Pin
machocr21-Mar-05 9:49
machocr21-Mar-05 9:49 

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.