Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
I

Imran Khan Pathan

@Imran Khan Pathan
About
Posts
985
Topics
133
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Download PDF from MY SQL database in asp.net
    I Imran Khan Pathan

    Sathesh Sakthivel wrote:

    Check by check points and find can u you able to retreive the data from MYSQL.

    Everything works file, file is created also, but does not open. It shows me that file is corrupted or not supported.

    please don't forget to vote on the post that helped you.

    ASP.NET database csharp asp-net mysql

  • Download PDF from MY SQL database in asp.net
    I Imran Khan Pathan

    Yes. It is installed. When I open file it shows me that file is corrupted. Thanks Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET database csharp asp-net mysql

  • Download PDF from MY SQL database in asp.net
    I Imran Khan Pathan

    Hey. I have one table in MySql Database. I have two field. documentBinary LongBlob documentContentType varchar My code to download file.

    byte[] data = (byte[])Dt.Rows[0]["documentBinary"];
    // encoding.GetBytes(Dt.Rows[0]["documentBinary"].ToString());// (byte[])Dt.Rows[0]["documentBinary"].ToString();

                System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
                response.ClearHeaders();
                response.ClearContent();
                response.Clear();
                //response.AddHeader("Content-Type", Dt.Rows\[0\]\["documentContentType"\].ToString());
                response.ContentType = Dt.Rows\[0\]\["documentContentType"\].ToString();
                response.AppendHeader("Content-Disposition",
                    "attachment; filename=" + Dt.Rows\[0\]\["titel"\].ToString() + ".pdf; size=" + data.Length.ToString());
    
                response.BinaryWrite(data);
                response.Flush();
                response.End();
    

    When I download file,File is downloaded successfully but not open in pdf format. Please look at my code and tell me where I am going wrong. Thanks Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET database csharp asp-net mysql

  • Image upload problem...
    I Imran Khan Pathan

    If you have already image in database and If user does not want to update image then why are you calling update method. There are two ways. 1. dont update database if user does not select the file.

    FileUpload UpldImage = (FileUpload)DetailsView1.FindControl("UpldImage");
    Label labelImage = (Label)DetailsView1.FindControl("labelImage");
    string im = labelImage.Text;
    if (UpldImage.HasFile)
    {
    string fileName = "~/ProductImages/" + UpldImage.FileName;
    SqlDataSource2.UpdateParameters["image"].DefaultValue = fileName;
    UpldImage.SaveAs(Server.MapPath(fileName));
    }

    2. Update database if you want but dont save image again because you have already file in folder.

    FileUpload UpldImage = (FileUpload)DetailsView1.FindControl("UpldImage");
    Label labelImage = (Label)DetailsView1.FindControl("labelImage");
    string im = labelImage.Text;
    if (UpldImage.HasFile)
    {
    string fileName = "~/ProductImages/" + UpldImage.FileName;
    SqlDataSource2.UpdateParameters["image"].DefaultValue = fileName;
    UpldImage.SaveAs(Server.MapPath(fileName));
    }
    else
    {
    SqlDataSource2.UpdateParameters["image"].DefaultValue = im;
    //UpldImage.SaveAs(Server.MapPath(im));
    }

    If you dont want to update any code, then please check else condition, what does im contain? and after executing else code, please check your folder to verify that file is exist or not. degun the code, you will get an idea. Regard

    please don't forget to vote on the post that helped you.

    ASP.NET sysadmin help

  • Event is not firing in custon control.
    I Imran Khan Pathan

    The problem is solved. Thanks.

    please don't forget to vote on the post that helped you.

    ASP.NET com sysadmin

  • Create textbox like query editor in sql server
    I Imran Khan Pathan

    You can not do it in TextBox, You have to use div element. On keypress event, you have to call javascript function where you need to read all string of div by splinting space and check if word are in listing then add font attribute or span attribute around word and set style. Search in google for how to write on div element. Regard Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET csharp database tutorial asp-net sql-server

  • Event is not firing in custon control.
    I Imran Khan Pathan

    Hey, I have created following code. But button event is not firing. Please look at the code and tell me where I am doing wrong.

    namespace immu.control
    {
    [ToolboxData("<{0}:myControl runat=server>")]
    public class docControl : WebControl
    {

        public Button btn;
    
        protected override void CreateChildControls()
        {
            Panel pnl = new Panel();
            btn = new Button();
            btn.Text = "Click Me";
            btn.Click += new EventHandler(btn\_Click);
            pnl.Controls.Add(btn);
            this.Controls.Add(pnl);
            //base.CreateChildControls();
        }
    
        public void btn\_Click(object sender, EventArgs e)
        {
            HttpContext.Current.Response.Redirect("http://google.com");
        }
    }
    

    }

    Thanks. Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET com sysadmin

  • Custom control : getting Rowcount 0 on button event of the control.
    I Imran Khan Pathan

    I am working on custom control. I am creating databound control. I have one property name RowDataSource that accept DataRowCollection as data source and I bind control on OnDataBinding event. I have another property name RowItem. My code looks like this.

    public DataRowCollection RowDataSource
    {
    get
    {
    if (ViewState["rowDataSource"] == null)
    {
    ViewState["rowDataSource"] = null;
    }
    return (DataRowCollection)ViewState["rowDataSource"];
    }
    set
    {
    if (value == null)
    {
    throw new ArgumentException("unvalid data source.", this.ID);
    }
    ViewState["rowDataSource"] = value;
    }
    }
    public RowCollections ExelRows
    {
    get
    {
    // rCollection is object of RowCollections class
    if (rCollection == null)
    {
    rCollection = new RowCollections();
    }
    return rCollection;

    }
    }

    OnDataBinding event code
    protected override void OnDataBinding(EventArgs e)
    {
    base.OnDataBinding(e);
    if (RowDataSource != null)
    {
    foreach (DataRow dr in RowDataSource)
    {
    //RowItem is my class
    RowItem item = new RowItem();
    item.Text = dr[rTitle].ToString();
    this.ExelRows.Add(item);
    }
    }
    }

    CreateChildControls method to render control
    protected override void CreateChildControls()
    {
    if (ExelRows.Count > 0)
    {
    //here i am rendering table structure to add exelrows and create control.
    }
    }

    Now, I am binding this control with DataRowCollection and It works file. I have one button in this control and I am raising bubble event when button is clicked. My problem is that when I click on button then CreateChildControls method is called first before OnDataBinding event. so I am getting ExelRows.Count = 0. so what I have to do to getting all rows on every bubble event of control. Thanks Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET wpf wcf help

  • Get Controls in htmlstring
    I Imran Khan Pathan

    sashidhar wrote:

    LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

    I tried to give him 5 vote but it did't work. when I click on button to vote, it goes to continuous process then I have to refresh page again. I am not able to vote any post here.

    please don't forget to vote on the post that helped you.

    ASP.NET html tutorial

  • Get Controls in htmlstring
    I Imran Khan Pathan

    Thanks Christian.

    please don't forget to vote on the post that helped you.

    ASP.NET html tutorial

  • Request.Querystring "undefined"
    I Imran Khan Pathan

    Yes. I know so I have deleted that post after posting it. Thanks

    please don't forget to vote on the post that helped you.

    ASP.NET help javascript sysadmin algorithms tools

  • Request.Querystring "undefined"
    I Imran Khan Pathan

    [Message Deleted]

    ASP.NET help javascript sysadmin algorithms tools

  • Get Controls in htmlstring
    I Imran Khan Pathan

    Christian Graus wrote:

    Your best bet to do that, is to use a string builder to generate the HTML yourself.

    I have to write all controls in HTML and I dont want to write inlinne code at server side. I know It is possible because I had done it before one year ago when I worked on custom control but now I forget it. :doh: regard Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET html tutorial

  • Get Controls in htmlstring
    I Imran Khan Pathan

    Hey. I am working on application in which I want to create dynamic controls and retrives them in html string. for example. public string CreateControl() { HtmlTable hTable = new HtmlTable(); hTable.CellPadding = 2; hTable.CellSpacing = 2; hTable.Width = "100%"; HtmlTableRow hRow = new HtmlTableRow(); HtmlTableCell hCell = new HtmlTableCell(); hCell.InnerText = "Username"; hRow.Cells.Add(hCell); hTable.Rows.Add(hRow); // Now here I want to return created controls in html string. } It should be like this <table CellPadding=2 CellSpacing = 2 Width=100><tr><td>Username</td></tr></table> Thanks Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET html tutorial

  • Unzip File On Server Using asp.Net
    I Imran Khan Pathan

    Refer ICSharpCode.SharpZipLib.Zip[^]. regard Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET csharp asp-net sysadmin help

  • Extending Base Type Functionality with Extension Methods
    I Imran Khan Pathan

    I got the solution.I got error at compile time that says 'Extension methods must be static' so I create one class named StringHelpers as static. public static class StringHelpers { public static int GetNumber(this string str) { return 1; } } Thanks Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET tutorial

  • Extending Base Type Functionality with Extension Methods
    I Imran Khan Pathan

    Abhishek Sur wrote:

    Now to call just use myString.GetNumber.

    I am not able to get it in intellisense when I am trying to get myString.GetNumber. Thanks Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET tutorial

  • Extending Base Type Functionality with Extension Methods
    I Imran Khan Pathan

    For Example. string myString = "This my Code : 589745"; string myCode = myString.GetNumber(); myString.GetNumber method returns number from string variable. I can write method to get number from string but I just need to know how to implement class that extend base type functionality. thanks Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET tutorial

  • Auto Logout ...please tell me the Answer
    I Imran Khan Pathan

    pkravikumar wrote:

    after sesstion timeout if am clicking any form that time loginpage will come, so in this regards i want login page autometically after sesstion timeout.give me solution

    I think he wants to login again automatically into system when session timeout and login page comes.

    please don't forget to vote on the post that helped you.

    ASP.NET

  • clear all textboxes in a form
    I Imran Khan Pathan

    foreach (Control cntr in this.Page.Controls) { if (cntr is TextBox) { ((TextBox)cntr).Text = ""; } } Regard Imrankhan

    please don't forget to vote on the post that helped you.

    ASP.NET tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups