|
in ascx codebehind add
protected void Page_Load(object sender, EventArgs e)
{
Button1.Attributes.Add("OnClick", "javascript:alert('your message');");
}
try and tell us how it worked
|
|
|
|
|
Hi
I have a gridview which has button that allows a user to click and download an xml file stored else where using force download - Response.AddHeader whether.
However, whilst this all works fine, when file is downloaded it prompts the user to save the file first and then opens the saved file in a new window. What I want to do is not to save the file first, but to immediately open the file in a new window without saving. I have tried all sorts of things, but none have satisfied the design I want to implement.
Thus:
1) Response.ContentType = "Applicaton/vnd.ms-xml"; This cause the user to save the file first before opening in a new page
2) Response.ContentType = "text/xml"; Opens in the window without saving first but opens in the existing window without allowing the user to go back to the gridview from where they clicked.
Does anyone have a way round this where I can open in a new window without saving?
Thanks
|
|
|
|
|
Create a separate page for Xml. Use window.open from the GridView Click where you can use your Xml writing logic.
|
|
|
|
|
Hello,
I am trying to set up a Master-Details feature with two distinct lists of links on the "Master" side and one control on the "Details" side, all displaying on the same page. For example, the Master control(s) would display a list of links to item details, separated into two sections:
Teachers
link1
link2
link3
Students
link1
link2
link3
...each of the links under both "Teachers" and "Students" would populate a single Details control with data appropriate to the selected link.
Right now I have a simple Master/Details on a single page using a single column gridview as the Master (<asp:ButtonField CommandName="Select" />) and a FormView control for Details. The Master Details relationship is handled declaratively with a <SelectParameters> in the Detail control's SQL Data Source. However, this arrangement only allows for a single column of Master links, i.e.:
Teachers & Students
link1
link2
link3
link4
link5
link6
...is there any way to
1. have two Master controls feed to the same details control?
2. have a Details control for each Master list, but swap visibility for each Detail control so it appears that there is only one Details control on the page?
3. have a Master control like a gridview or datalist display two sections of links, one on top of the other, each section with its own HeaderText, controlling the same Details control?
4. or perhaps use a pair of Master Gridviews nested within a parent Master Gridview leading to the single Details control?
I'm not sure what the best way to proceed is - thanks for any advice!
|
|
|
|
|
Hi
How to get unique session id that generated same for all browser tabs and different and always unique when we close and open new browser in asp.net code.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
Could you please phrase your question clearly?
FYI,
You will get an Unique Session ID only when the Session is created.
|
|
|
|
|
Sessions are usually based on cookies and it would be upto the browser as to whether tabs can share cookies or they are persited after the browser is cleared (provided you've set an expiry date).
A new session is created when a valid session cookie isn't found by ASP.Net.
|
|
|
|
|
I'm developing in apsx.net and vb.net 2005.
I have 3 pages in my application that are longer than one viewing screen, causing the uwser to scroll to update and see data down the page. The first is of static size, that is the actual page size does not change, there is just a lot of information on the page and the user needs to be able to see all and make changes before processing.
The other two pages are dynamic in nature based on choices that the client makes.
The problem I'm having is that each time the user makes a change that required him to scroll down the page, when the page refreshes, it returns to the top, forcing the user to scroll back down the page to see the affect of his changes.
How do I get the page to refresh with the same view the user had when the change was made.
Thanks in advance for your assistance..
Chuck..
|
|
|
|
|
Anchor tag is your friend. Look at the named anchor tag. When you post to the page, pass the anchor tag and the page will scroll (automagically) on refresh.
Anchor Tag Help[^]
|
|
|
|
|
Thanks for the start..
I have 2 followup questions:
1) does that mean I have to put 'a name="[name of field]"' on every field that can be updated, including the dynamic fields?
2) how is the reference invoked upon refresh, please show code snippet?
Thanks again..
Chuck..
|
|
|
|
|
Ok, the general notion is that you add named anchor tags to your page, say something like
<a NAME="ID218395" HREF="#"><a>
notice the title for the anchor tag is blank, so it can not be seen by the user. If you want to be click-able then give it a title
<a NAME="ID218395" HREF="#">My Cool Link<a>
now call the page as
myCoolPage.aspx#ID218395
that is all.
|
|
|
|
|
I have the same prblems with my long page, pls is there no way
other than using the anchor tags?
thanks.
|
|
|
|
|
Enobong Adahada wrote: I have the same prblems
what is your prblems problems. speak up (properly) and you may be heard. What is wrong with the named anchor tag. I use it on very long page and a have plenty sprinkled though out the page.
|
|
|
|
|
Yusuf, this looks like something that will really work for me.
First I have never used anchors before so there a little be of confusion here on my part. This is an asp.net with vb.net as the code behind.
So when something is changed that causes a postback then the code behind is invoked. How do I activate the anchor location so when the page is redisplayed it envokes the target anchor because there will be at least 20 anchors on each page?
So just to be clear I don't have a problem with creating a hundred anchors if necessary, it is just how to activate the appropiate anchor. If for example an entry from the travel dropdownlist is selected I will need to process the selection then redisplay the page. Upon selecting the dropdownlist theI will need to know its anchor. After exceuting the AutoPostBack routine I will want to return to the anchor for that dropdownlist location.
I hope I am not making this too complicated.
Thanks again..
Chuck..
|
|
|
|
|
MacIntyre wrote: First I have never used anchors before so there a little be of confusion here on my part.
Chris, don't feel bad. We're all there one day or another. We'd to start from zero.
MacIntyre wrote: This is an asp.net with vb.net as the code behind.
No matter what you are using, behind the scene, it will spit out HTML code. So, you need to hone your HTML knowledge. Anchor tags are one example.
MacIntyre wrote: How do I activate the anchor location so when the page is redisplayed it envokes the target anchor because there will be at least 20 anchors on each page?
Well, what is causing the page refresh? Is it button click? or other user action? If it is button click then you need to add the anchored tag to your Response.Redirect() page.
If you give us some more detail about your code we may help you.
|
|
|
|
|
MacIntyre wrote: looks like something that will really work for me.
I wouldn't use it. It is cumbersome and unmaintainable.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Yusuf wrote: Anchor tag is your friend
Not in this situation. It is a cumbersome and unmaintainable mechanism for this usage
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Damn classic asp. You are right. I have being working on the classic asp lately and my memory is filled with that filth
|
|
|
|
|
Ok, so we have been through that exercise and discovered that for implementing asp.net that it is not practical to do this.
What is a more practical solution, remembering that this is webforms?
We are talking the use of both buttons and dropdownlists and exiting from fields that have changed..
Thanks again..
|
|
|
|
|
So will this work with all types of returns, field changes, button clicks and changes in dropdownlists?
|
|
|
|
|
Have you read the documentation?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
No sir. Not yet..
I was looking at the next message and inquiring?
Thanks..
|
|
|
|
|
Mark, Great Answer..
The only problem is the documentation on how to is a little obscure for those of use that did not go through the embedded asp wars.
But as you say a little research will get to the answer.
Thanks again for a great call...
Chuck..
|
|
|
|