Click here to Skip to main content
15,897,371 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionThis is weird! [modified] Pin
Waleed Eissa26-Jun-08 0:10
Waleed Eissa26-Jun-08 0:10 
AnswerRe: This is weird! Pin
Christian Graus26-Jun-08 0:19
protectorChristian Graus26-Jun-08 0:19 
GeneralRe: This is weird! Pin
Waleed Eissa26-Jun-08 0:29
Waleed Eissa26-Jun-08 0:29 
AnswerRe: This is weird! Pin
N a v a n e e t h26-Jun-08 16:09
N a v a n e e t h26-Jun-08 16:09 
GeneralRe: This is weird! Pin
Waleed Eissa27-Jun-08 3:00
Waleed Eissa27-Jun-08 3:00 
QuestionServer Application Error? Pin
bug_aonz25-Jun-08 23:26
bug_aonz25-Jun-08 23:26 
AnswerRe: Server Application Error? Pin
eyeseetee25-Jun-08 23:32
eyeseetee25-Jun-08 23:32 
Questionhow to populate a second dropdown list depend on the selection of 1st ddl Pin
Meax25-Jun-08 23:24
Meax25-Jun-08 23:24 
at the moment i am using this but it is not working.

code to populate 1st ddl from sql server

Table format:
FruitCat nvarchar(50)
FruitName nvarchar(50)

<br />
Private Sub GetFruitsCat()<br />
<br />
        Dim objConnection As SqlConnection = New _<br />
            SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDB;Data Source=MyServer\SQLEXPRESS")<br />
<br />
        objConnection.Open()<br />
<br />
        Dim myCommand As New System.Data.SqlClient.SqlCommand()<br />
        myCommand.Connection = objConnection<br />
<br />
        myCommand.CommandText = "SelectAllTheFruitsCat"<br />
        myCommand.CommandType = CommandType.StoredProcedure<br />
<br />
        Dim param As New System.Data.SqlClient.SqlParameter()<br />
<br />
        <br />
        Dim myAdapter As New SqlDataAdapter(myCommand)<br />
<br />
        myAdapter.Fill(DataSetOfAllTheFruitsCat)<br />
<br />
        <br />
        Dim reader As SqlDataReader = myCommand.ExecuteReader()<br />
        <br />
<br />
        DDLFruitsCat.DataSource = DataSetOfAllTheFruitsCat<br />
<br />
        DDLFruitsCat.DataTextField = "FruitCat"<br />
<br />
        DDLFruitsCat.DataBind()<br />
        <br />
        objConnection.Close()<br />
<br />
    End Sub<br />


This is the code to get Fruit depending on the fruit category selected in the 1st DDL
<br />
Private Sub GetFruits()<br />
        Dim objConnection As SqlConnection = New _<br />
            SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDB;Data Source=MyServer\SQLEXPRESS")<br />
<br />
        objConnection.Open()<br />
<br />
        Dim myCommand As New System.Data.SqlClient.SqlCommand()<br />
        myCommand.Connection = objConnection<br />
<br />
        myCommand.CommandText = "SelectASpesificCatFruit"<br />
        myCommand.CommandType = CommandType.StoredProcedure<br />
<br />
        Dim param As New System.Data.SqlClient.SqlParameter()<br />
<br />
<br />
        param = myCommand.Parameters.Add("@FruitCat", _<br />
                                          SqlDbType.NVarChar)<br />
        param.Direction = ParameterDirection.Input<br />
        param.Value = DDLFruitCat.Text<br />
<br />
        Dim myAdapter As New SqlDataAdapter(myCommand)<br />
<br />
        myAdapter.Fill(DataSetOfFruit)<br />
<br />
        Dim reader As SqlDataReader = myCommand.ExecuteReader()<br />
<br />
        DDLFruit.DataSource = DataSetOfFruit<br />
<br />
        DDLFruit.DataTextField = "FruitName"<br />
<br />
        DDLFruit.DataBind()<br />
<br />
        objConnection.Close()<br />
End Sub<br />


i am calling GetFruits here
<br />
Protected Sub DDLFruitsCat_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDLFruitsCat.SelectedIndexChanged<br />
        GetFruits()<br />
End Sub<br />


2nd ddl is not changing according to data in 1st ddl.
AnswerRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
eyeseetee25-Jun-08 23:30
eyeseetee25-Jun-08 23:30 
AnswerRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Christian Graus25-Jun-08 23:36
protectorChristian Graus25-Jun-08 23:36 
AnswerRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Arindam Tewary25-Jun-08 23:39
professionalArindam Tewary25-Jun-08 23:39 
AnswerRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Imran Khan Pathan25-Jun-08 23:51
Imran Khan Pathan25-Jun-08 23:51 
GeneralRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Sherin Iranimose25-Jun-08 23:56
Sherin Iranimose25-Jun-08 23:56 
GeneralRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Imran Khan Pathan26-Jun-08 0:01
Imran Khan Pathan26-Jun-08 0:01 
GeneralRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Sherin Iranimose26-Jun-08 0:11
Sherin Iranimose26-Jun-08 0:11 
GeneralRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Christian Graus25-Jun-08 23:58
protectorChristian Graus25-Jun-08 23:58 
GeneralRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
eyeseetee26-Jun-08 0:07
eyeseetee26-Jun-08 0:07 
GeneralRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Sherin Iranimose26-Jun-08 0:12
Sherin Iranimose26-Jun-08 0:12 
AnswerRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Sherin Iranimose25-Jun-08 23:57
Sherin Iranimose25-Jun-08 23:57 
GeneralRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Christian Graus25-Jun-08 23:59
protectorChristian Graus25-Jun-08 23:59 
GeneralRe: how to populate a second dropdown list depend on the selection of 1st ddl Pin
Meax27-Jun-08 23:56
Meax27-Jun-08 23:56 
QuestionHtml Encoder Pin
RajeevKumarSharma25-Jun-08 23:12
RajeevKumarSharma25-Jun-08 23:12 
AnswerRe: Html Encoder Pin
Arindam Tewary25-Jun-08 23:45
professionalArindam Tewary25-Jun-08 23:45 
QuestionAdvantage of Converting Excel to CSV and uploading to database (SQL Server)?? [modified] Pin
Karan_TN25-Jun-08 22:46
Karan_TN25-Jun-08 22:46 
AnswerRe: Advantage of Converting Excel to CSV and uploading to database (SQL Server)?? Pin
Christian Graus25-Jun-08 23:11
protectorChristian Graus25-Jun-08 23:11 

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.