Monday, November 30, 2009
Sunday, November 29, 2009
Popup in asp.net 2.0
in default.aspx.cs page
protected void btnPopup_Click(object sender, EventArgs e)
{
string sFeature = "dialogWidth: 400px; dialogHeight: 250px;";
string sUrl = "Popup.aspx?Info=No Shipping Information";
Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowPopup", "");
}
in popup.aspx.cs page
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lblPopInfo.Text = Request.QueryString["Info"].ToString();
}
}
protected void btnPopup_Click(object sender, EventArgs e)
{
string sFeature = "dialogWidth: 400px; dialogHeight: 250px;";
string sUrl = "Popup.aspx?Info=No Shipping Information";
Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowPopup", "");
}
in popup.aspx.cs page
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lblPopInfo.Text = Request.QueryString["Info"].ToString();
}
}
Wednesday, November 25, 2009
Tuesday, November 24, 2009
Monday, November 23, 2009
Add Requisition
public void AddRequisition(GridView grid)
{
myReq = (Requisition)Session["MyRequisition"];
rc = new RequisitionController();
for (int i = 0; i < grid.Rows.Count; i++)
{
CheckBox chk = (CheckBox)grid.Rows[i].FindControl("CheckBox1");
TextBox txtQty = (TextBox)grid.Rows[i].Cells[2].Controls[1];
string q = txtQty.Text;
if ((chk != null) && (chk.Checked == true))
{
if (q != "")
{
if (ValidateInputQty(q))
{
int qty = int.Parse(q.ToString());
String reqItemCode = grid.Rows[i].Cells[0].Text;
String strDescription = grid.Rows[i].Cells[1].Text;
try
{
rc.addRequest(qty, reqItemCode, strDescription, myReq);
Label2.Text = "You have selected the following items:";
displayButtons(true);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
else
{
Label2.Text = "Quantity should be number.";
}
}
else
{
Label2.Text = "Please enter quantity.";
}
}
else if ((q != ""))
{
if (ValidateInputQty(q) != true)
{ Label2.Text = "Quantity should be number, and please select."; }
else
{ Label2.Text = "Please select."; }
}
}
}
{
myReq = (Requisition)Session["MyRequisition"];
rc = new RequisitionController();
for (int i = 0; i < grid.Rows.Count; i++)
{
CheckBox chk = (CheckBox)grid.Rows[i].FindControl("CheckBox1");
TextBox txtQty = (TextBox)grid.Rows[i].Cells[2].Controls[1];
string q = txtQty.Text;
if ((chk != null) && (chk.Checked == true))
{
if (q != "")
{
if (ValidateInputQty(q))
{
int qty = int.Parse(q.ToString());
String reqItemCode = grid.Rows[i].Cells[0].Text;
String strDescription = grid.Rows[i].Cells[1].Text;
try
{
rc.addRequest(qty, reqItemCode, strDescription, myReq);
Label2.Text = "You have selected the following items:";
displayButtons(true);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
else
{
Label2.Text = "Quantity should be number.";
}
}
else
{
Label2.Text = "Please enter quantity.";
}
}
else if ((q != ""))
{
if (ValidateInputQty(q) != true)
{ Label2.Text = "Quantity should be number, and please select."; }
else
{ Label2.Text = "Please select."; }
}
}
}
gridview codings
protected void btnRemove_Click(object sender, EventArgs e)
{
Requisition myReq3 = (Requisition)Session["MyRequisition"];
for (int i = 0; i < gridDetails.Rows.Count; i++)
{
CheckBox chk2 = (CheckBox)gridDetails.Rows[i].FindControl("CheckBox1");
if (chk2 != null && chk2.Checked == true)
{
string reqItem = gridDetails.Rows[i].Cells[0].Text;
if (myReq3 != null)
{
try
{
myReq3.DeleteItem(reqItem);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
{
Requisition myReq3 = (Requisition)Session["MyRequisition"];
for (int i = 0; i < gridDetails.Rows.Count; i++)
{
CheckBox chk2 = (CheckBox)gridDetails.Rows[i].FindControl("CheckBox1");
if (chk2 != null && chk2.Checked == true)
{
string reqItem = gridDetails.Rows[i].Cells[0].Text;
if (myReq3 != null)
{
try
{
myReq3.DeleteItem(reqItem);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
Subscribe to:
Posts (Atom)