Click here to Skip to main content
15,923,689 members
Home / Discussions / C#
   

C#

 
GeneralRe: Drop Highlights in Tree Views? Pin
McClamm18-Aug-05 10:06
McClamm18-Aug-05 10:06 
GeneralRe: Drop Highlights in Tree Views? Pin
miah alom18-Aug-05 11:17
miah alom18-Aug-05 11:17 
GeneralRe: Drop Highlights in Tree Views? Pin
McClamm18-Aug-05 11:51
McClamm18-Aug-05 11:51 
Generalhaving filefilter problem Pin
Pyro Joe18-Aug-05 8:29
Pyro Joe18-Aug-05 8:29 
GeneralRe: having filefilter problem Pin
sgatto15918-Aug-05 8:36
sgatto15918-Aug-05 8:36 
GeneralRe: having filefilter problem Pin
Pyro Joe18-Aug-05 8:50
Pyro Joe18-Aug-05 8:50 
GeneralRe: having filefilter problem Pin
sgatto15918-Aug-05 9:00
sgatto15918-Aug-05 9:00 
QuestionHow to Use DropDownList in ASP.NET Pin
dwark10618-Aug-05 7:53
dwark10618-Aug-05 7:53 
Hi Everyone,

I am facing a problem while using DropDownList. Actually I am retrieveing company name from Sql server and displaying on DropDownList (value + id).

If I select DropDownList(just like combo box), it displays me 1st records corresponding to that record(ID). But if I click 2nd,3rd and fourth and so on from DropDownList company name , every time it displays me only 1st record on textbox.


//////////////This is server side program(Update.aspx)//////////////
<%@ Page language="c#" Codebehind="Update.aspx.cs" AutoEventWireup="false" Inherits="Myprogram.Update" %>


Select Company Name:    asp:DropDownList id="DropDownList1" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" runat="server"
Width="160px" Height="16px"
DataTextField="Display" DataValueField="Value">
/asp:DropDownList>
Customer Name:    <asp:textbox id="txtCustomerName" runat="server" width="160px">


/////////Update.aspx.cs////////////
protected void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(this.SelectedItemCombo)
{
DetailsOfRecords();
}
}

protected void DetailsOfRecords()
{
thisConnection.Open();
thisCommand = thisConnection.CreateCommand();

thisCommand.CommandText = " SELECT * from Customers where CustomerID=" + this.DropDownList1.SelectedValue.ToString();

thisReader = thisCommand.ExecuteReader();
while(thisReader.Read())
{
string strID = thisReader["CustomerID"].ToString();
if(strID == this.DropDownList1.SelectedValue.ToString())
{
this.txtCustomerName.Text = thisReader["CustomerName"].ToString();
this.txtCompany.Text = thisReader["Company"].ToString();
}
}
thisReader.Close();
thisConnection.Close();
}
AnswerRe: How to Use DropDownList in ASP.NET Pin
sgatto15918-Aug-05 8:29
sgatto15918-Aug-05 8:29 
GeneralRe: How to Use DropDownList in ASP.NET Pin
dwark10618-Aug-05 9:05
dwark10618-Aug-05 9:05 
GeneralRe: How to Use DropDownList in ASP.NET Pin
sgatto15918-Aug-05 9:28
sgatto15918-Aug-05 9:28 
GeneralRe: How to Use DropDownList in ASP.NET Pin
dwark10618-Aug-05 11:42
dwark10618-Aug-05 11:42 
GeneralRecursive method calling (is it wrong?) Pin
therealmccoy18-Aug-05 7:22
therealmccoy18-Aug-05 7:22 
GeneralRe: Recursive method calling (is it wrong?) Pin
Judah Gabriel Himango18-Aug-05 7:27
sponsorJudah Gabriel Himango18-Aug-05 7:27 
GeneralRe: Recursive method calling (is it wrong?) Pin
Dan Neely18-Aug-05 7:30
Dan Neely18-Aug-05 7:30 
GeneralRe: Recursive method calling (is it wrong?) Pin
therealmccoy18-Aug-05 18:50
therealmccoy18-Aug-05 18:50 
GeneralRegular Expression Pin
vuthaianh18-Aug-05 7:15
vuthaianh18-Aug-05 7:15 
GeneralRe: Regular Expression Pin
sgatto15918-Aug-05 8:39
sgatto15918-Aug-05 8:39 
GeneralRe: Regular Expression Pin
eggie518-Aug-05 11:01
eggie518-Aug-05 11:01 
GeneralDealing with dpi Pin
sgatto15918-Aug-05 6:48
sgatto15918-Aug-05 6:48 
GeneralRe: Dealing with dpi Pin
Dan Neely18-Aug-05 7:12
Dan Neely18-Aug-05 7:12 
GeneralRe: Dealing with dpi Pin
sgatto15918-Aug-05 8:24
sgatto15918-Aug-05 8:24 
GeneralGet Message ID after Sending in Message Q Pin
DeepToot18-Aug-05 6:28
DeepToot18-Aug-05 6:28 
GeneralRe: Get Message ID after Sending in Message Q Pin
leppie18-Aug-05 6:36
leppie18-Aug-05 6:36 
GeneralRe: Get Message ID after Sending in Message Q Pin
DeepToot18-Aug-05 6:52
DeepToot18-Aug-05 6:52 

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.