Monday, October 22, 2007

Tip Dialog Box in ASP.NET

easy Dailog box in ASP.NET i'm use to show Error use "JavaScript"

Response.Write("<script>");


Response.Write("alert('Hello World');");


Response.Write("</script>");

it will show message Dialog when it work.

Saturday, October 6, 2007

ส่งค่าข้าม Page กับ ASP.NET

หน้าแรก

public partial class SendFile : System.Web.UI.Page
{
public string getFilePath
{
get {
HttpPostedFile pf = fileupload.PostedFile;
return pf.FileName;
}
}
// เมื่อคลิกส่ง

protected void cmdXMLInfo_Click(object sender, EventArgs e)
{
Server.Transfer("~/XmlDescription.aspx", true);
}
}

หน้าสองรับข้อมูลจากหน้าแรก



<%@ PreviousPageType VirtualPath="JobCreator2.aspx" %>
public partial class XmlDescription : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string filePath = "";
if (PreviousPage != null)
{
SendFile sf = PreviousPage as SendFile;
if (sf != null)
{
try
{
filePath = sf.getFilePath;
XmlManage xm = new XmlManage();
MyProcess[] mypro = xm.ReadXmlFrom(filePath);
gridviewXML.DataSource = mypro;
gridviewXML.DataBind();
}
catch(Exception err)
{
result.Text = err.Message;
}
}
}
}

}