16,020,626 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 10066916 (Top 34 by date)
Member 10066916
20-Mar-14 2:57am
View
yes vick! this does work thank you very much...but when i reload my page the contents are seen again..I dont want them to be seen again..any idea how do i do this?
Member 10066916
1-Nov-13 10:37am
View
the sum doesn't seem to be appearing in the textbox
Member 10066916
1-Nov-13 10:37am
View
I tried this...its not working...
Member 10066916
30-Oct-13 13:29pm
View
I tried it out again..this seems to be working...but when i click on remove it still shows the same value..can someone help
function showCal(obj) {
var val = document.getElementById(obj.id).value;
if(val!='' && !isNaN(val) ){
var prvVal = document.getElementById('txt').value;
prvVal= (!isNaN(prvVal))?prvVal:0;
document.getElementById('txt').value = parseInt(prvVal) + parseInt(val);
}
}
</script>
Member 10066916
13-Oct-13 7:14am
View
The exact error is Insert statement conflicted with foreign key constraint.
Member 10066916
13-Oct-13 7:04am
View
can u elaborate a bit more?...I still didn't understand..all the values are already inserted in the M_Division,M_Designation and M_emp_personal...
Member 10066916
10-Oct-13 12:59pm
View
public partial class temporaryduty : System.Web.UI.Page
{
private int divisionId;
private int designationId;
............
if (objDs.Tables[0].Rows.Count > 0)
{
lbldiv.Text = objDs.Tables[0].Rows[0]["DIVISION"].ToString();
lbldesig.Text = objDs.Tables[0].Rows[0]["Designation"].ToString();
divisionId = objDs.Tables[0].Rows[0]["Expr1"];
designationId = objDs.Tables[0].Rows[0]["Expr2"];
}
submit button
cmd.Parameters.AddWithValue("@DIVID", divisionId);
cmd.Parameters.AddWithValue("@DesigID", designationId);
something like this...
Member 10066916
23-Sep-13 11:42am
View
yes thats the thing...I dont know how to define it...through datagrid view...i find it very confusing...
Member 10066916
23-Sep-13 9:27am
View
IsActive is not getting updated in the database??...can some one tell me whats wrong?
protected void submit(object sender, EventArgs e)
{
// *Get the Gridview Row* //
DataGridItem drow = (DataGridItem)(sender as Control).Parent.Parent;
RadioButton rbpApprove = (RadioButton)drow.FindControl("rbtnapprove");
RadioButton rbpReject = (RadioButton)drow.FindControl("rbtnreject");
if (rbpApprove.Checked == true)
{
conn.Open();
SqlCommand cmd = new SqlCommand("Update table set IsActive= 0 where ARGID=@ARGID", conn);
cmd.ExecuteNonQuery();
conn.Close();
}
else if (rbpReject.Checked == true)
{
conn.Open();
SqlCommand cmd = new SqlCommand("Update table set IsActive= 1 where ARGID=@ARGID", conn);
cmd.ExecuteNonQuery();
conn.Close();
}
string empid = dgi.Cells[0].Text;
string employeename = dgi.Cells[2].Text;
string designation = dgi.Cells[3].Text;
conn.Open();
SqlCommand comm = new SqlCommand("insert into [T_TADA_aaprovereject_groupdirector] values (" + empid + ",'" + employeename + "','" + designation + "')", conn);
comm.ExecuteNonQuery();
conn.Close();
}
}
Member 10066916
19-Sep-13 9:01am
View
ok ill try this out ...thank you so much :)
Member 10066916
11-Sep-13 23:08pm
View
there are some groups and the admin will divide the data
Member 10066916
11-Sep-13 13:03pm
View
thank you ryan :)
Member 10066916
11-Sep-13 12:35pm
View
yes this is what i was looking for..thank you :)
Member 10066916
11-Sep-13 12:28pm
View
I did that...Its taking in the from date and to date values from the textbox...but it skips the if condition...and thats y the dropdown list is empty
Member 10066916
11-Sep-13 12:14pm
View
the admin can group 002 or 005 or maybe 010 or 152 anything...
Member 10066916
11-Sep-13 12:13pm
View
that is upto the admin to group whichever ref numbers he/she wants to
Member 10066916
4-Aug-13 12:54pm
View
yes..its like this...when an element from the group drop down list is clicked the name drop down list appears...when an element from name drop down list is clicked...the designation should appear into the label...
Member 10066916
1-Aug-13 8:55am
View
hey thanx for ur prompt reply...but it doesnt work....it goes on selecting the first name...
Member 10066916
1-Aug-13 3:51am
View
The ASP.NET code is
<pre lang="HTML"> <asp:DropDownList ID="ddlgroup" runat="server"
style="z-index: 1; left: 118px; top: 148px; position: absolute; height: -5px;"
AutoPostBack="True"
onselectedindexchanged="ddlgroup_SelectedIndexChanged1">
<asp:DropDownList ID="ddlname" runat="server"
style="z-index: 1; left: 332px; top: 147px; position: absolute; height: 35px; width: 117px;"
onselectedindexchanged="ddlname_SelectedIndexChanged" AutoPostBack="True">
<table style="width: 85%; removed 207px; removed 14px; removed: absolute; height: 593px;">
<tr>
<td class="style5">
2.</td>
<td class="style7">
DESIGNATION</td>
<td colspan="3">
<asp:Label ID="lbldes" runat="server" Text="Label">
</td>
</tr>
Member 10066916
1-Aug-13 3:44am
View
sure...I have updated my question...
Member 10066916
31-Jul-13 13:05pm
View
I enabled the autopostback true for the group dropdownlist...but when i enable the autopostback for name dropdownlist...it doesnt let me select any other values in the name dropdownlist...it directly selects the first value and displays the first employee's designation...whereas when I disable the autopostback for the name dropdownlist it doesnt trigger any value for the label...where am i goin wrong?can anyone help me out.
Below is my C# code that i changed
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
public partial class Forms__form : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection("Server=SOFTDEV1; Database=2903_SOFTDEV; Integrated security = true");
protected void Page_Load(object sender, EventArgs e)
{
DropDownList7.Visible = false;
if (!IsPostBack)
{
Getdata();//adding the division to the dropdown box
}
}
/* Adding The contents to the Division DropDown List */
private void Getdata()
{
SqlCommand cmd = new SqlCommand("SELECT DivisionID, DivShort FROM M_Division ORDER BY DivShort", conn);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
ddlgroup.DataSource = objDs.Tables[0];
ddlgroup.DataTextField = "DivShort";
ddlgroup.DataValueField = "DivisionID";
ddlgroup.DataBind();
ddlgroup.Items.Insert(0, "--Select--");
}
}
/*Adding the names to the Name DropDownList based on the selected division from Division Drop Down List*/
private void FillName(int divisionID)
{
SqlCommand cmd = new SqlCommand("SELECT DivisionID, EmpName FROM M_Emp_Personal WHERE DivisionID =@DivisionID AND IsActive=1 ORDER BY EmpName", conn);
cmd.Parameters.AddWithValue("@DivisionID", divisionID);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
ddlname.DataSource = objDs.Tables[0];
ddlname.DataTextField = "EmpName";
ddlname.DataValueField = "DivisionID";
ddlname.DataBind();
ddlname.Items.Insert(0, "--Select--");
}
}
/*Selecting the division present in the dropdownlist*/
protected void ddlgroup_SelectedIndexChanged1(object sender, EventArgs e)
{
int DivisionID = Convert.ToInt32(ddlgroup.SelectedValue.ToString());
FillName(DivisionID);
ddlname.SelectedIndex = 0;
}
/*Selecting the name present in the dropdownlist*/
protected void ddlname_SelectedIndexChanged(object sender, EventArgs e)
{
int DesingID = Convert.ToInt32(ddlgroup.SelectedValue.ToString());
FillDesig(DesingID);
}
private void FillDesig(int desingID)
{
SqlCommand cmd = new SqlCommand("Select M_Designation.DesigLong,M_Emp_Personal.EmpName From M_Designation inner join M_Emp_Personal on M_Designation.DesigID=M_Emp_Personal.DesigID", conn);
cmd.Parameters.AddWithValue("@DivisionID", divisionID);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
lbldes.Text=objDs.Tables[0].Rows[0]["designation_name"].tostring();
}
}
Member 10066916
31-Jul-13 13:04pm
View
I enabled the autopostback true for the group dropdownlist...but when i enable the autopostback for name dropdownlist...it doesnt let me select any other values in the name dropdownlist...it directly selects the first value and displays the first employee's designation...whereas when I disable the autopostback for the name dropdownlist it doesnt trigger any value for the label...where am i goin wrong?can anyone help me out.
Below is my C# code that i changed
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
public partial class Forms__form : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection("Server=SOFTDEV1; Database=2903_SOFTDEV; Integrated security = true");
protected void Page_Load(object sender, EventArgs e)
{
DropDownList7.Visible = false;
if (!IsPostBack)
{
Getdata();//adding the division to the dropdown box
}
}
/* Adding The contents to the Division DropDown List */
private void Getdata()
{
SqlCommand cmd = new SqlCommand("SELECT DivisionID, DivShort FROM M_Division ORDER BY DivShort", conn);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
ddlgroup.DataSource = objDs.Tables[0];
ddlgroup.DataTextField = "DivShort";
ddlgroup.DataValueField = "DivisionID";
ddlgroup.DataBind();
ddlgroup.Items.Insert(0, "--Select--");
}
}
/*Adding the names to the Name DropDownList based on the selected division from Division Drop Down List*/
private void FillName(int divisionID)
{
SqlCommand cmd = new SqlCommand("SELECT DivisionID, EmpName FROM M_Emp_Personal WHERE DivisionID =@DivisionID AND IsActive=1 ORDER BY EmpName", conn);
cmd.Parameters.AddWithValue("@DivisionID", divisionID);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
ddlname.DataSource = objDs.Tables[0];
ddlname.DataTextField = "EmpName";
ddlname.DataValueField = "DivisionID";
ddlname.DataBind();
ddlname.Items.Insert(0, "--Select--");
}
}
/*Selecting the division present in the dropdownlist*/
protected void ddlgroup_SelectedIndexChanged1(object sender, EventArgs e)
{
int DivisionID = Convert.ToInt32(ddlgroup.SelectedValue.ToString());
FillName(DivisionID);
ddlname.SelectedIndex = 0;
}
/*Selecting the name present in the dropdownlist*/
protected void ddlname_SelectedIndexChanged(object sender, EventArgs e)
{
int DesingID = Convert.ToInt32(ddlgroup.SelectedValue.ToString());
FillDesig(DesingID);
}
private void FillDesig(int desingID)
{
SqlCommand cmd = new SqlCommand("Select M_Designation.DesigLong,M_Emp_Personal.EmpName From M_Designation inner join M_Emp_Personal on M_Designation.DesigID=M_Emp_Personal.DesigID", conn);
cmd.Parameters.AddWithValue("@DivisionID", divisionID);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
lbldes.Text=objDs.Tables[0].Rows[0]["designation_name"].tostring();
}
}
Member 10066916
31-Jul-13 13:03pm
View
I enabled the autopostback true for the group dropdownlist...but when i enable the autopostback for name dropdownlist...it doesnt let me select any other values in the name dropdownlist...it directly selects the first value and displays the first employee's designation...whereas when I disable the autopostback for the name dropdownlist it doesnt trigger any value for the label...where am i goin wrong?can anyone help me out.
Below is my C# code that i changed
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
public partial class Forms__form : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection("Server=SOFTDEV1; Database=2903_SOFTDEV; Integrated security = true");
protected void Page_Load(object sender, EventArgs e)
{
DropDownList7.Visible = false;
if (!IsPostBack)
{
Getdata();//adding the division to the dropdown box
}
}
/* Adding The contents to the Division DropDown List */
private void Getdata()
{
SqlCommand cmd = new SqlCommand("SELECT DivisionID, DivShort FROM M_Division ORDER BY DivShort", conn);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
ddlgroup.DataSource = objDs.Tables[0];
ddlgroup.DataTextField = "DivShort";
ddlgroup.DataValueField = "DivisionID";
ddlgroup.DataBind();
ddlgroup.Items.Insert(0, "--Select--");
}
}
/*Adding the names to the Name DropDownList based on the selected division from Division Drop Down List*/
private void FillName(int divisionID)
{
SqlCommand cmd = new SqlCommand("SELECT DivisionID, EmpName FROM M_Emp_Personal WHERE DivisionID =@DivisionID AND IsActive=1 ORDER BY EmpName", conn);
cmd.Parameters.AddWithValue("@DivisionID", divisionID);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
ddlname.DataSource = objDs.Tables[0];
ddlname.DataTextField = "EmpName";
ddlname.DataValueField = "DivisionID";
ddlname.DataBind();
ddlname.Items.Insert(0, "--Select--");
}
}
/*Selecting the division present in the dropdownlist*/
protected void ddlgroup_SelectedIndexChanged1(object sender, EventArgs e)
{
int DivisionID = Convert.ToInt32(ddlgroup.SelectedValue.ToString());
FillName(DivisionID);
ddlname.SelectedIndex = 0;
}
/*Selecting the name present in the dropdownlist*/
protected void ddlname_SelectedIndexChanged(object sender, EventArgs e)
{
int DesingID = Convert.ToInt32(ddlgroup.SelectedValue.ToString());
FillDesig(DesingID);
}
private void FillDesig(int desingID)
{
SqlCommand cmd = new SqlCommand("Select M_Designation.DesigLong,M_Emp_Personal.EmpName From M_Designation inner join M_Emp_Personal on M_Designation.DesigID=M_Emp_Personal.DesigID", conn);
cmd.Parameters.AddWithValue("@DivisionID", divisionID);
DataSet objDs = new DataSet();
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
sd.Fill(objDs);
conn.Close();
if (objDs.Tables[0].Rows.Count > 0)
{
lbldes.Text=objDs.Tables[0].Rows[0]["designation_name"].tostring();
}
}
Member 10066916
30-Jul-13 2:56am
View
Thank you...i will try this out :)
Member 10066916
30-Jul-13 2:55am
View
thank you ...I will try this out
Member 10066916
30-Jul-13 2:55am
View
I should enable autopost back for label??....but i dont want the label to trigger anymore values...in other textboxes,dropdownlist...etc..
Member 10066916
29-Jul-13 10:45am
View
ok ill try that again....thanx :)
Member 10066916
29-Jul-13 10:43am
View
maybe my query is wrong or something...i tried executing it on SQL and it worked....i enabled auto postback to both dropdown lists...but still no go :(
Member 10066916
29-Jul-13 10:41am
View
oops...sorry ...i just updated my question....
Member 10066916
29-Jul-13 10:39am
View
yes...I now i have enabled autopostback for both the dropdownlists....but still its not giving me the right value in the label....
Member 10066916
29-Jul-13 10:35am
View
thank you for the update Orcun Iyigun
Member 10066916
24-Jul-13 5:18am
View
I have again re written the code...can someone please tell me where I am going wrong??
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Data.OleDb;
public partial class Forms_Master_Forms_Temporary_duty_form : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection("Server=SOFTDEV1; Database=ADE_2903_SOFTDEV; Integrated security = true");
protected void Page_Load(object sender, EventArgs e)
{
DropDownList7.Visible = false;
if (!IsPostBack)
{
GetData();
}
}
protected void GetData()
{
SqlCommand cmd = new SqlCommand("select divid from M_Division ", conn);
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
DataTable dt = new DataTable();
sd.Fill(dt);
DropDownList3.DataSource = dt;
DropDownList3.DataTextField = "DivShort";
DropDownList3.DataValueField = "Divid";
DropDownList3.DataBind();
conn.Close();
}
protected void addname(int divid)
{
SqlCommand cmd = new SqlCommand("select emp_name from M_Emp_Personal where DivisionID=@divisionId", conn);
SqlDataAdapter sd = new SqlDataAdapter(cmd);
conn.Open();
DataTable dt = new DataTable();
sd.Fill(dt);
DropDownList4.DataSource = dt;
DropDownList4.DataTextField = "EmpName";
DropDownList4.DataValueField = "divid";
DropDownList4.DataBind();
conn.Close();
}
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
int divid=Convert.ToInt32(DropDownList3SelectedValue.ToString());
addname(int divid);
}
}
Member 10066916
24-Jul-13 4:57am
View
yes I am able to binda data to drop down box from the database. ...what I am not able to do is...when a certain item is selected from one dropdown box(these items are got from a database) it should display few items in the second drop down box from a different database..
Member 10066916
28-Jun-13 12:12pm
View
thank you :)...and yup I am kind of new to programming...and I am learning that's y just wanted to know the logic :)
Show More