GridView in ModalDialog +C# +ASP.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fayazmd
    New Member
    • Jul 2007
    • 41

    GridView in ModalDialog +C# +ASP.NET

    Hi,

    I am creating a webpage having GridView. In GridView i have a column Accolades, a link button column. On clicking of Accolades, a modal window is opened. That modal window has a gridview, where i am displaying all uploaded files. This GridView first column is a template column, having link button, text of the button will be FileName. On clicking of file name file should be opened. For that I wrote a method to open the file. Its working fine if you are opening as a popup(window.op en). But my requirement is to show in modal(window.sh owmodaldialog).

    If you are clicking the file name in modal window, the file is not opening. Its calling the method to open the file, but file is not opening. I put <base target="_self"> in aspx file of modal page.

    Any suggestions?

    Here is the code to open the file

    protected void DownloadFile(st ring szFilePath)
    {
    Stream iStream;
    byte[] buffer = new byte[99999999];
    int length;
    long dataToRead;
    string filename = Path.GetFileNam e(szFilePath);
    try
    {
    iStream = new FileStream(szFi lePath, System.IO.FileM ode.Open, System.IO.FileA ccess.Read, System.IO.FileS hare.Read);
    dataToRead = iStream.Length;

    Response.Conten tType = "applicatio n/octet-stream";
    Response.AddHea der("Content-Disposition", "attachment ; filename=" + filename);

    while (dataToRead > 0)
    {
    if (Response.IsCli entConnected)
    {
    length = iStream.Read(bu ffer, 0, 99999998);
    Response.Output Stream.Write(bu ffer, 0, length);

    Response.Flush( );

    buffer = new byte[99999999];
    dataToRead = dataToRead - length;
    }
    else
    {
    dataToRead = -1;
    }
    }
    iStream.Dispose ();
    }
    catch (Exception oExp)
    {
    throw oExp;
    }
    }
  • fayazmd
    New Member
    • Jul 2007
    • 41

    #2
    GridView in ModalDialog +asp.net

    Hi,

    I am creating a webpage having GridView. In GridView i have a column Accolades, a link button column. On clicking of Accolades, a modal window is opened. That modal window has a gridview, where i am displaying all uploaded files. This GridView first column is a template column, having link button, text of the button will be FileName. On clicking of file name file should be opened. For that I wrote a method to open the file. Its working fine if you are opening as a popup(window.op en). But my requirement is to show in modal(window.sh owmodaldialog).

    If you are clicking the file name in modal window, the file is not opening. Its calling the method to open the file, but file is not opening. I put <base target="_self"> in aspx file of modal page.

    Any suggestions?

    Here is the code to open the file

    protected void DownloadFile(st ring szFilePath)
    {
    Stream iStream;
    byte[] buffer = new byte[99999999];
    int length;
    long dataToRead;
    string filename = Path.GetFileNam e(szFilePath);
    try
    {
    iStream = new FileStream(szFi lePath, System.IO.FileM ode.Open, System.IO.FileA ccess.Read, System.IO.FileS hare.Read);
    dataToRead = iStream.Length;

    Response.Conten tType = "applicatio n/octet-stream";
    Response.AddHea der("Content-Disposition", "attachment ; filename=" + filename);

    while (dataToRead > 0)
    {
    if (Response.IsCli entConnected)
    {
    length = iStream.Read(bu ffer, 0, 99999998);
    Response.Output Stream.Write(bu ffer, 0, length);

    Response.Flush( );

    buffer = new byte[99999999];
    dataToRead = dataToRead - length;
    }
    else
    {
    dataToRead = -1;
    }
    }
    iStream.Dispose ();
    }
    catch (Exception oExp)
    {
    throw oExp;
    }
    }

    Comment

    Working...