System.Drawing.Image img = System.Drawing.Image.FromStream(FileUpload.InputStream);
System.Drawing.Image thumbnailImage = img.GetThumbnailImage(25, 30, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
img.save(stringPath);
Thursday, October 28, 2010
select all checkbox in asp.net
function SelectAll(id)
{
var frm = document.forms[0];
for (i=0;i
{
if (frm.elements[i].type == "checkbox")
{
frm.elements[i].checked = document.getElementById(id).checked;
}
}
}
Place this text in your source File : {
// HeaderTemplate in tag <> //
// asp:CheckBox ID="chkAll" runat="server" in tag <>//
// HeaderTemplate in tag <>//
}
In Code File protected void grdmember_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
//adding an attribute for onclick event on the check box in the header
//and passing the ClientID of the Select All checkbox
((CheckBox)e.Row.FindControl("chkAll")).Attributes.Add("onclick", "javascript:SelectAll('" + ((CheckBox)e.Row.FindControl("chkAll")).ClientID + "')");
}
}
{
var frm = document.forms[0];
for (i=0;i
{
if (frm.elements[i].type == "checkbox")
{
frm.elements[i].checked = document.getElementById(id).checked;
}
}
}
{
if (e.Row.RowType == DataControlRowType.Header)
{
//adding an attribute for onclick event on the check box in the header
//and passing the ClientID of the Select All checkbox
((CheckBox)e.Row.FindControl("chkAll")).Attributes.Add("onclick", "javascript:SelectAll('" + ((CheckBox)e.Row.FindControl("chkAll")).ClientID + "')");
}
}
Saturday, October 23, 2010
How to Download File from asp.net
string st, doctitle;
doctitle = e.CommandArgument.ToString();
st = Server.MapPath("../documents") + "//" + doctitle;
FileInfo f = new FileInfo(st);
if (f.Exists == true)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" + f.Name);
Response.AddHeader("content.length", f.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(f.FullName);
Response.End();
}
doctitle = e.CommandArgument.ToString();
st = Server.MapPath("../documents") + "//" + doctitle;
FileInfo f = new FileInfo(st);
if (f.Exists == true)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" + f.Name);
Response.AddHeader("content.length", f.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(f.FullName);
Response.End();
}
Subscribe to:
Posts (Atom)