Click here to Skip to main content
15,923,557 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Relate to Update panel Pin
Sandeep Akhare22-Apr-08 3:36
Sandeep Akhare22-Apr-08 3:36 
QuestionRe: Relate to Update panel Pin
Ankit At Codeproject22-Apr-08 3:40
Ankit At Codeproject22-Apr-08 3:40 
GeneralRe: Relate to Update panel Pin
Sandeep Akhare22-Apr-08 3:43
Sandeep Akhare22-Apr-08 3:43 
QuestionRe: Relate to Update panel Pin
Ankit At Codeproject22-Apr-08 20:04
Ankit At Codeproject22-Apr-08 20:04 
QuestionRe: Relate to Update panel Pin
Ankit At Codeproject22-Apr-08 20:18
Ankit At Codeproject22-Apr-08 20:18 
GeneralRe: Relate to Update panel Pin
Sandeep Akhare22-Apr-08 20:34
Sandeep Akhare22-Apr-08 20:34 
QuestionRe: Relate to Update panel Pin
Ankit At Codeproject22-Apr-08 20:41
Ankit At Codeproject22-Apr-08 20:41 
QuestionRe: Relate to Update panel Pin
Ankit At Codeproject22-Apr-08 20:21
Ankit At Codeproject22-Apr-08 20:21 
this is my aspx.cs page

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using MySql.Data.MySqlClient;

public partial class Default2 : System.Web.UI.Page
{
DataSet ds;
MySqlConnection mcon;
MySqlCommand mcmd;
MySqlDataAdapter mda;
DataTable dt;
DataRow dr;

protected void Page_Init(object sender, EventArgs e)
{
mcon = new MySqlConnection("Database=tsmdemo;Server= 172.16.1.22;uid=root;pwd=tops123;");
mcon.Open();
if(!IsPostBack)
{

btnAddRow();
btnAddRow();
fillddl();
}

}

protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
if (tshf.Value == "Save")
{

lblmy.Text = grdnew.Rows.Count.ToString();
savedata();
tshf.Value = "";
}
else if (tshf.Value == "AddRow")
{
lblmy.Text = grdnew.Rows.Count.ToString();
btnAddRow();
fillddl();
tshf.Value = "";
}
}
}
protected void btnAddRow()
{
dt = CreateDataTable();
grdnew.DataSource = dt;
grdnew.DataBind();
Session["TimeSheet"] = "AddNew";
}
protected void btnDisRow()
{

dt = (DataTable)ViewState["DataTable"];
grdnew.DataSource = dt;
grdnew.DataBind();
}

protected DataTable CreateDataTable()
{
DataTable dtvalues = (DataTable)ViewState["DataTable"];
if (dtvalues == null)
{
dtvalues = new DataTable();
dtvalues.Columns.Add(new DataColumn("", typeof(string)));
dtvalues.Columns.Add(new DataColumn("Name", typeof(string)));
dtvalues.Columns.Add(new DataColumn("contactNo", typeof(string)));
dtvalues.Columns.Add(new DataColumn("email", typeof(string)));
dtvalues.Columns.Add(new DataColumn("designation", typeof(string)));
ViewState["DataTable"] = dtvalues;
}
else
{
dr = dtvalues.NewRow();
dtvalues.Rows.Add(dr);
ViewState["DataTable"] = dtvalues;
}
return dtvalues;
}
protected void fillddl()
{
try
{
mcmd = new MySqlCommand("Select * from tbldesignation;", mcon);
mda = new MySqlDataAdapter(mcmd);
ds = new DataSet();
mda.Fill(ds);

if ((String)Session["TimeSheet"] == "AddNew")
{
lblmy.Text = grdnew.Rows.Count.ToString();
foreach (GridViewRow row in grdnew.Rows)
{
DropDownList ddl = (DropDownList)row.FindControl("ddldesg");
ddl.DataSource = ds;
ddl.DataBind();
}
}
if ((String)Session["TimeSheet"] == "Getdata")
{
lblmy.Text = grdnew.Rows.Count.ToString();
foreach (GridViewRow row in grdnew.Rows)
{
DropDownList ddl = (DropDownList)row.FindControl("ddldesg");
ddl.DataSource = ds;
ddl.DataBind();
TextBox temp = (TextBox)row.FindControl("Textbox4");
ddl.SelectedIndex = Convert.ToInt32(temp.Text);
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
ds.Dispose();
mda.Dispose();
mcmd.Dispose();

}

}
protected void savedata()
{
string cmdText;

try
{
lblmy.Text = grdnew.Rows.Count.ToString();
foreach (GridViewRow gdr in grdnew.Rows)
{
string name = ((TextBox)gdr.FindControl("TextBox1")).Text;
string contactNo = ((TextBox)gdr.FindControl("TextBox2")).Text;
string email = ((TextBox)gdr.FindControl("TextBox3")).Text;
int designation = ((DropDownList)gdr.FindControl("ddldesg")).SelectedIndex;
cmdText = "INSERT INTO tblempinfo VALUES ('"
+ name + "','" + contactNo + "','" + email + "'," + Convert.ToString(designation + 1) + ")";
mcmd = new MySqlCommand(cmdText, mcon);
mcmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
mcmd.Dispose();
}

}
protected void btnSave_Click(object sender, EventArgs e)
{

}

protected void bUpdate1_Click(object sender, EventArgs e)
{

}
}
GeneralRe: Relate to Update panel Pin
Sandeep Akhare22-Apr-08 23:13
Sandeep Akhare22-Apr-08 23:13 
GeneralRe: Relate to Update panel Pin
eyeseetee22-Apr-08 3:31
eyeseetee22-Apr-08 3:31 
QuestionRe: Relate to Update panel Pin
Ankit At Codeproject22-Apr-08 3:34
Ankit At Codeproject22-Apr-08 3:34 
GeneralAjax and Browser positioning Pin
db0000722-Apr-08 1:46
db0000722-Apr-08 1:46 
GeneralRe: Ajax and Browser positioning Pin
eyeseetee22-Apr-08 1:53
eyeseetee22-Apr-08 1:53 
GeneralRe: Ajax and Browser positioning Pin
Sandeep Akhare22-Apr-08 3:27
Sandeep Akhare22-Apr-08 3:27 
QuestionNeed to sned data or mail to fogbugz api by using .net? Pin
subbu.sk22-Apr-08 1:27
subbu.sk22-Apr-08 1:27 
AnswerRe: Need to sned data or mail to fogbugz api by using .net? Pin
eyeseetee22-Apr-08 1:50
eyeseetee22-Apr-08 1:50 
GeneralRe: Need to sned data or mail to fogbugz api by using .net? Pin
subbu.sk22-Apr-08 2:09
subbu.sk22-Apr-08 2:09 
GeneralPassword Column in GridView Pin
Usharva22-Apr-08 0:32
Usharva22-Apr-08 0:32 
GeneralRe: Password Column in GridView Pin
Blue_Boy22-Apr-08 1:04
Blue_Boy22-Apr-08 1:04 
GeneralRe: Password Column in GridView Pin
Ashish Sehajpal22-Apr-08 2:05
Ashish Sehajpal22-Apr-08 2:05 
Questionvalidations not working with IE 7 Pin
Krazy Programmer21-Apr-08 23:50
Krazy Programmer21-Apr-08 23:50 
GeneralRe: validations not working with IE 7 Pin
eyeseetee21-Apr-08 23:57
eyeseetee21-Apr-08 23:57 
GeneralRe: validations not working with IE 7 Pin
Blue_Boy21-Apr-08 23:57
Blue_Boy21-Apr-08 23:57 
GeneralRe: validations not working with IE 7 Pin
Krazy Programmer22-Apr-08 0:00
Krazy Programmer22-Apr-08 0:00 
GeneralRe: validations not working with IE 7 Pin
Blue_Boy22-Apr-08 0:08
Blue_Boy22-Apr-08 0:08 

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.