473,804 Members | 3,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnSelectedIndex Changed - New Browser Window

I have a DataGrid which contains 1 visible column which is a LinkButton:

<Columns>
<asp:BoundColum n DataField="Prod uctId"
Visible="False" ></asp:BoundColumn >
<asp:BoundColum n DataField="Down loadURL"
Visible="False" ></asp:BoundColumn >
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:LinkButt on ID="lnkArticle " Runat="server"
Text='<%#DataBi nder.Eval(Conta iner, "DataItem.Title ")%>'
CommandName="Se lect" />
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>

The data source is a table of PDF files. It contains the Id, the path to the
file, and the title of the file. On the SelectCommand event of the DataGrid,
all I'm doing is streaming the PDF file to the browser:

protected void dgReader_OnSele ctedIndexChange d(object sender,
System.EventArg s e){
Response.ClearC ontent();
Response.ClearH eaders();
Response.Conten tType = "applicatio n/pdf";
Response.WriteF ile(dgReader.Se lectedItem.Cell s[1].Text);
Response.Flush( );
Response.Close( );
}

When I click the select button, I'd like the streaming of the PDF to happen
in a new window.

One very important thing is that I can't pass a query string in the URL (to
prevent URL tampering). Of course, I could do this with a Guid if that's
what it came down to.

Thanks a million for your help
Nov 18 '05 #1
1 1469
"George Durzi" <gd****@hotmail .com> wrote in message
news:ut******** *****@tk2msftng p13.phx.gbl...
I have a DataGrid which contains 1 visible column which is a LinkButton:

<Columns>
<asp:BoundColum n DataField="Prod uctId"
Visible="False" ></asp:BoundColumn >
<asp:BoundColum n DataField="Down loadURL"
Visible="False" ></asp:BoundColumn >
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:LinkButt on ID="lnkArticle " Runat="server"
Text='<%#DataBi nder.Eval(Conta iner, "DataItem.Title ")%>'
CommandName="Se lect" />
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>

The data source is a table of PDF files. It contains the Id, the path to the file, and the title of the file. On the SelectCommand event of the DataGrid, all I'm doing is streaming the PDF file to the browser:

protected void dgReader_OnSele ctedIndexChange d(object sender,
System.EventArg s e){
Response.ClearC ontent();
Response.ClearH eaders();
Response.Conten tType = "applicatio n/pdf";
Response.WriteF ile(dgReader.Se lectedItem.Cell s[1].Text);
Response.Flush( );
Response.Close( );
}

When I click the select button, I'd like the streaming of the PDF to happen in a new window.


You can't create a new window from the server. Only the client can do that.

Instead of the LinkButton, you could use a HyperLink, with Target="_blank" .
Use a GUID in the query string of the URL, and have the newly-requested page
translate that GUID into the PDF file which the second page would stream.
--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
9465
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to intercept the key so that I can do stuff on the server side to make the new window behave correctly? (We have a JSP-based webapp which stores state in the session. Now if two windows access (and modify!) the same session, then madness will result....
12
10180
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical scrollbar, you get the height of the entire document, screwing up any chance of centering a window in the browser using these values. Is there a way to get the height of the actual browser window and not the entire page height? Thanks.
33
4083
by: randau | last post by:
Linking to a Targeted Browser Window I'd like to open reference links to other web sites in a separate browser window from the browser window hosting my own web site pages. The Link Target reserve word "_blank" opens a blank new browser window for every link, which can sometimes result in a lot of open browser windows. Is there no way to "reuse" a previously linked browser window and have it load the new web page in Foreground
6
3066
by: G Dean Blake | last post by:
in my aspx app I am writing a stream that works fine but it replaces what is in the client browser window. The code is as follows: .. .. HttpContext.Current.Response.ClearHeaders() HttpContext.Current.Response.ClearContent() HttpContext.Current.Response.ContentType = "application/pdf" Dim myBuffer(MyStream.Length) As Byte MyStream.Read(myBuffer, 0, CType(MyStream.Length, Integer)) HttpContext.Current.Response.BinaryWrite(myBuffer)
1
4440
by: Paul L | last post by:
Hi, I have an issue with the OnSelectedIndexChanged event not firing for a DropDownList control which is in the ItemTemplate of a DataList. I have made an exact copy of the DropDownList control, and placed it outside of the DataList and it fires the event just fine. So it's definitely to do with it being in a template. I've managed to reproduce the issue on a small test app, the code and html is below:
2
16102
by: glenn | last post by:
Hi folks, I am trying to determine which item in a DropDownList Web control has been selected. I have posted an OnSelectedIndexChanged subroutine in my code with a reference to the subroutine in my asp tag as shown here: <asp:DropDownList id="ddlTo" runat="server"
1
1872
by: Groove | last post by:
I have a strange problem. It seems that for some reason, a OnSelectedIndexChanged event is no producing an error in IE6. What concerns me is that I just performed that large Windows update a couple of weeks ago and it updated ActiveX "stuff" in IE. I'm not sure if the update has effected IE or there's something wrong with mt .net application. I have a simple DDL. It calls a sub when the value in the DDL is changed. Now, when I change...
0
1518
by: Groove | last post by:
(repost!) I have a simple and common scenario. I'm developing pages in VWD and FTP-ing them over to a test servr running Window 2003, NET2 Framework. On my page, I have a DDL that causes a postback and executes a sub when the value has changed. For some reason, it just quit working. I get a js error in IE6 (but NOT in FF 1.5) and gives me a vague error about: 'event' is null or not an object.Line X, character X.
0
2521
by: toeffetommy | last post by:
Hello, I need a piece of functionality developed for our Website and I need some technical advice on how get there. Essentially, what I want to develop is a browser-within-browser functionality where the ‘mini-browser’ has similar functionality to a normal browser. Let me explain: Firstly, our website interface will open up in a popup window. All the normal browser toolbars and buttons have been removed from the popup window. It’s...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.