|
Hello,
I have a couple of link buttons and I am trying to get them to open a page in a new window. I know how to do this with a normal link, but I also have some very simple code behind that I need to run (Set a session variable).
I am writing this in C#, and have had no luck getting the page to open with the session variable passed.
Let me know if you have any suggestions, or if you know how to do this through a normal link. Thanks for your time.
C# Code
protected void lnkEnterprise_Click(object sender, EventArgs e)
{
Session["Owner"] = 1;
Response.Redirect("~/SampleDashboardDetails.aspx");
}
JM
|
|
|
|
|
JohnQuar1 wrote: Response.Redirect("~/SampleDashboardDetails.aspx");
Well, this is your problem. Obviously, given how ASP.NET works, redirecting in your C# code can never open a new window, that's just impossible. You need to open a new window in your client side code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I agree with you, and I would write some small javascript to do this, but I need to pass that session variable as well. The page I am trying to open has a gridview that has a session variable parameter as an input, so I need to pass the session before the page loads so that the gridview is immediately populated.
|
|
|
|
|
how about using
this.ClientScript.RegisterStartupScript(this.GetType(), "aa", "window.open(\"yourpage.aspx?s=" + Session["val"].ToString() + "\");", true);
means passing through querystring?
|
|
|
|
|
javascript:window.open('SampleDashboardDetails.aspx', ...) is the only option to you.
You have to do this from client side as Christian suggested.
you can use
this.ClientScript.RegisterStartupScript(this.GetType(), "aa", "window.open(...);", true);
to write the script response to the client.
|
|
|
|
|
So I'm a little confused, does this.ClientScript.RegisterStartupScript(this.GetType(), "aa", "window.open(\"~/SampleDashboardDetails.aspx?s=" + Session["Owner"].ToString() + "\");", true); go on the page I am trying to open in the page load?
Thanks.
JM
|
|
|
|
|
I found a solution. I ended up changing the link buttons to links and passed a variable through the link, then grabbed the variable and stored it to the session variable I was using in a Page_PreInit function.
Send it from first page:
<asp:HyperLink ID="lnkEnterprise" runat="server" NavigateUrl="~/SampleDashboardDetails.aspx?Owner=1" Target="_blank">Enterprise Details</asp:HyperLink>
Receive on second page:
protected void Page_PreInit(Object sender, EventArgs e)
{
Session["Owner"] = Request.QueryString["Owner"];
}
Thanks for your help guys.
|
|
|
|
|
Hi,
<table id="myTable" border="1">
<tr> <b><td>Name </td> <td>Age</td></b></tr>
<tr> <td>Shivani </td> <td>25</td> </tr>
<tr> <td>Naren </td> <td>28</td> </tr>
<tr> <td>Logs</td> <td>57</td> </tr>
<tr> <td>Kas</td> <td>54</td> </tr>
<tr> <td>Sent </td> <td>26</td> </tr>
<tr> <td>Bruce </td> <td>7</td> </tr>
</table>
The above table is in my aspx page. One button name is download. Once i click the download button it will be download and write and save into excel file?? Is it possible??
Hope yours reply. Please make soon reply me. Its very urgent.
Every Successful Person Have A Painful Story
|
|
|
|
|
From where are you getting these data ? What is the data source? If it is from Data Table you can easily import it to Excel file.
|
|
|
|
|
Its not a data table. It is an aspx page that is --.table have an id. How can i import to excel. Not only data. Whatever it is in this table how write and save it to excel???
Every Successful Person Have A Painful Story
|
|
|
|
|
If you don't have a data source, if it's plain old html in your page, then the answer is almost certainly string mashing code, or perhaps regex..
Of course, if you just have a html page in your website, then you can just manually create your excel file from that data, as it's not going to change.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
I have two treeviews in my page which are working inside an update panel. The issue is,the vertical scroll bar is not displaying properly for the right most treeview and it is happening only in IE6. In IE7 it is working fine. Is there any workaround for this? Please suggest.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
use
style.overflow = scroll;
|
|
|
|
|
where should i add this? while loading the treeview incodebehind?
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hello All,
In my application i have to save xml file data to database using web service.
So please tell how xml file can be passed to web service method.
xml file resides in the web application root directory so how it can be read inside web service
method.
Thanks in advance
|
|
|
|
|
|
I have around 200+ controls in a page. Each of the sets of controls are kept in divs and when header div is clicked, only those div controls pertaining to that header div will be displayed. Rest of the divs are kept invisible. When the page loads, all these 200+ controls are loaded simultaneously, that consumes much of the time. What my requirement is I want to get the div1 controls loaded when the page loads and rest of the div controls should be loaded asynchronously. it should not be loaded with page load, so that time for loading the page can be much minimised. Hope u understood my question and pls help me out with a solution asap....
when the page loads, i just want to see 10 controls loaded from db, which is n 1 div. when i click on the next div header, next div details with 10 controls are loaded. but all these 12 divs are loaded from db when the page loads itself.
All these things are designed and developed. what i was asked is performance tuning. Note that, they are using Telerik controls in the pages. I have tried with Telerik RADAJAXManager. but am facing a problem with javascript calls in this.
Pls help.
modified on Wednesday, September 30, 2009 1:14 AM
|
|
|
|
|
sanrah wrote: I have around 200+ controls in a page
Instead of thinking of a solution to the problem, I would rather sit and re-design the interface and the workflow.
It does not make sense to have 200+ controls on a single page...
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I would first consider the design of your page. Are all 200+ controls necessary on a single page or could it be broken into several pages? It may make sense to you but the user will probably be overwhelmed by so many controls on a single page.
Otherwise, you'll need to
1) Use JavaScript to create the controls dynamically
2) Use AJAX calls to retrieve the html to insert into your page
only two letters away from being an asset
|
|
|
|
|
If you can't divide the page then try to use JQuery and AJAX calls
to dynamically create the required controls which will increase the performance.
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
when the page loads, i just want to see 10 controls loaded from db, which is n 1 div. when i click on the next div header, next div details with 10 controls are loaded. but all these 12 divs are loaded from db when the page loads itself.
All these things are designed and developed. what i was asked is performance tuning. Note that, they are using Telerik controls in the pages. I have tried with Telerik RADAJAXManager. but am facing a problem with javascript calls in this.
Pls help.
|
|
|
|
|
Don't have much exposure to telerik controls.
why don't you try using a tab control?
jus check whether telerik has a tab control which
will dynamically load the corressponding section
on the tab click.
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
Hi all,
I want to redirect to the called page(aaa.aspx) after i logged in.By default i redirected to some other page(bbb.aspx).How to redirect to the called page .Please help me..
|
|
|
|
|
Response.Redirect("aaa.aspx",false);
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|