Click here to Skip to main content
15,909,503 members
Home / Discussions / C#
   

C#

 
QuestionDelete a folder with data in c#.net Pin
Malayil alex22-Dec-05 18:54
Malayil alex22-Dec-05 18:54 
AnswerRe: Delete a folder with data in c#.net Pin
Gerben Jongerius22-Dec-05 18:55
Gerben Jongerius22-Dec-05 18:55 
Questionelectronic usage Pin
Sheharyar_JH22-Dec-05 18:29
Sheharyar_JH22-Dec-05 18:29 
AnswerRe: electronic usage Pin
GDavy22-Dec-05 20:52
GDavy22-Dec-05 20:52 
GeneralRe: electronic usage Pin
leppie23-Dec-05 0:07
leppie23-Dec-05 0:07 
GeneralRe: electronic usage Pin
Dave Kreskowiak23-Dec-05 6:05
mveDave Kreskowiak23-Dec-05 6:05 
AnswerRe: electronic usage Pin
leppie23-Dec-05 0:10
leppie23-Dec-05 0:10 
QuestionDatagrid problem in c# Pin
yaminilathatv22-Dec-05 17:53
yaminilathatv22-Dec-05 17:53 
Hi all, idont know where am i going wrong please help me.My idea is that, i am retrieving the deptnames from database into the dropdown list and afterthe selection of the deptname the respective details are to be displayed on the datagrid. The code is working till the dropdownlist.

code to get deptnames to the dropdownlist:
private void Page_Load(object sender, System.EventArgs e)
{
try
{
connectdb();
Cmd.CommandText = "Select distinct (Dept) from emp";
da.SelectCommand = Cmd;
da.Fill(ds,"Emp");
DropDownList1.Items.Clear();
foreach (DataRow dr in ds.Tables["emp"].Rows)
{
DropDownList1.Items.Add(dr["Dept"].ToString());
}

}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Con.Close();
}


code to dispaly the details onto datagrid:
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
try
{
connectdb();
Cmd.CommandText = "Select * from emp Where Dept Like '" + DropDownList1.SelectedItem.Value.ToString() + "' order by Empno";
da.SelectCommand = Cmd;
da.Fill(ds,"Emp");
DataGrid1.DataSource = ds;
DataGrid1.DataMember = "Emp";
DataGrid1.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Con.Close();
}

Note: The same code is working if i enter the deptname in a textbox and click the button to display details on to the datagid. But the code is not working if i select the option in the dropdownlist.Is the event Dropdownlist_SelectedIndexChanged relevent or any other events are there to select the dropdownlist.
pleasehelp me

thanks in advance
yamini
AnswerRe: Datagrid problem in c# Pin
PrakashBhaskar22-Dec-05 18:07
PrakashBhaskar22-Dec-05 18:07 
QuestionVirtual and override. Pin
HakunaMatada22-Dec-05 17:23
HakunaMatada22-Dec-05 17:23 
AnswerRe: Virtual and override. Pin
Gerben Jongerius22-Dec-05 19:06
Gerben Jongerius22-Dec-05 19:06 
GeneralRe: Virtual and override. Pin
HakunaMatada22-Dec-05 19:39
HakunaMatada22-Dec-05 19:39 
AnswerRe: Virtual and override. Pin
GDavy22-Dec-05 20:47
GDavy22-Dec-05 20:47 
GeneralRe: Virtual and override. Pin
HakunaMatada22-Dec-05 21:26
HakunaMatada22-Dec-05 21:26 
QuestionWebService Pin
flysky61822-Dec-05 16:24
flysky61822-Dec-05 16:24 
AnswerRe: WebService Pin
Dave Kreskowiak22-Dec-05 17:59
mveDave Kreskowiak22-Dec-05 17:59 
GeneralRe: WebService Pin
flysky61822-Dec-05 20:11
flysky61822-Dec-05 20:11 
GeneralRe: WebService Pin
Dave Kreskowiak23-Dec-05 3:52
mveDave Kreskowiak23-Dec-05 3:52 
QuestionDirectX app crashing Pin
Christian Graus22-Dec-05 16:18
protectorChristian Graus22-Dec-05 16:18 
AnswerRe: DirectX app crashing Pin
mav.northwind22-Dec-05 21:56
mav.northwind22-Dec-05 21:56 
GeneralRe: DirectX app crashing Pin
Christian Graus23-Dec-05 11:35
protectorChristian Graus23-Dec-05 11:35 
AnswerRe: DirectX app crashing Pin
leppie23-Dec-05 0:13
leppie23-Dec-05 0:13 
QuestionDelete command with DataSet and DataAdapter Pin
Stefan R22-Dec-05 13:45
Stefan R22-Dec-05 13:45 
AnswerRe: Delete command with DataSet and DataAdapter Pin
Dave Kreskowiak22-Dec-05 15:52
mveDave Kreskowiak22-Dec-05 15:52 
AnswerRe: Delete command with DataSet and DataAdapter Pin
Dave Kreskowiak22-Dec-05 16:14
mveDave Kreskowiak22-Dec-05 16:14 

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.