|
I got an error:
CS0103: The name 'Server' does not exist in the current context
HttpContext.Current.Response.Write("window.open('PopUpMessage.aspx?RecNum='" + Server.UrlEncode(this.rdr[0])+ "'PopUpMessage','dependent=yes, resizable=yes, width=300, height=150');");
|
|
|
|
|
Try this
HttpContext.Current.Response.Write("<script language='JavaScript'>window.open('PopUpMessage.aspx?RecNum='" + Server.UrlEncode(this.rdr[0])+ "','PopUpMessage','dependent=yes, resizable=yes, width=300, height=150');</script>");
|
|
|
|
|
It gives me this error:
Compiler Error Message: CS0103: The name 'Server' does not exist in the current context
HttpContext.Current.Response.Write("window.open('PopUpMessage.aspx?RecNum='" + Server.UrlEncode(this.rdr[0])+ "'Show Message','dependent=yes, resizable=yes, width=300, height=150');");
|
|
|
|
|
Hi,
I'm developing a treeview control in which by default if i click on all the parent nodes they are getting expanded. but my requirement is if i click on any of the parent node the remaining nodes are to be collapsed.
Is there any property in the design time to accomplish this, please let me know what is the best way to do this.
thanks,
Mohan
M.MohanVamsi
|
|
|
|
|
hi,
i'd like to access to a menu control in my master page so i wrote the following code in the page that uses master page but it returns error
protected void Page_Load(object sender, EventArgs e)
{
Menu MenuCat = this.Form.Parent.FindControl("MenuCat");
...
Error message:
Error 434 Cannot implicitly convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.Menu'. An explicit conversion exists (are you missing a cast?)
anyone knows what should i do?
|
|
|
|
|
i found it!!
i guess i should use this code:
protected void Page_Load(object sender, EventArgs e)
{
Menu MenuCat = (Menu)this.Form.Parent.FindControl("MenuCat");
Menu MenuSort = (Menu)this.Form.Parent.FindControl("MenuSort");
Menu MenuTypes = (Menu)this.Form.Parent.FindControl("MenuTypes");
Menu MenuLanguage = (Menu)this.Form.Parent.FindControl("MenuLanguage");
|
|
|
|
|
That works, but what I would do, is write a base page for all my pages, and in that base page, put a property that returns a strongly typed instance of my specific master page, as opposed to the Master property which returns the common base class.
At a minimum, I would store the names of those Menu controls as a resource, so you don't have to remember them and cannot mistype them, and I would check if FindControl returned null, so your site doesn't blow up if one of them is renamed or something.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
how to use ajax in asp.net 2.0
Signature preview salil_k_singh 11:06 15 Jul '07
|
|
|
|
|
Which control of AJAX you want to use?
I Love T-SQL
|
|
|
|
|
Depends what you mean. AJAX itself is just javascript. That's all it is, you don't need any special library or download, you can write AJAX code with notepad.
Given the tone of your question ( which indicates you're not willing to do any research on your own ), I assume you don't want to use AJAX at all, but just drag and drop some controls onto a form and have them do AJAX for you. In that case, you need to download the ASP.NET AJAX library, install it, and read the docs.
I recommend reading the article I link to in my sig for a start.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i'm sorry to repeat the question
the first question is :
hi,,
on my project asp.net with c#
I added a javascript item for eg,, name : JS.js
and made the next function :
function PopUpQtyWindow(id)
{
window.open("productqty.aspx?id=" + id, "Cart", "status = 1, height = 150, width = 200, resizable = 0");
}
then on any page i tried to call this function as next :
int prodID = 1 ;
HyperTest.NavigateUrl = "javascript:PopUpQtyWindow(" + prodID + ");";
when running project and press the hyperTest .. Internet status bar message " Error on page " .
the thing that make that the same code on a solution is work as good and another one doesn't work ..
remark ,, i copy the code as it from the source one to another.
if any one from our friends can aid my i will give him
jooooo
|
|
|
|
|
Yeah, you did ask this before. Did you respond to the answers you got ? Did you check the details of the error in the manner that I explained to you ? Did you try firefox/firebug to help you work out the problem ? Or did you just find nothing you could cut and paste to solve the issue, and so just posted it again ?
We can't help. We don't know what the error is. We've explained to you how to work that out, once you do, and can post with more info, then we can help more.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
my friend ,,
take me easy
i swear i spent a day to try to solve it ,,
i download firebug ,,
the code is working with me on a project ,,
i copy it for another ,, without any result ,,,
the error is only that the status bar told me that error on page..
and what making me confused that the code is correct , and is working with another project ,,,,
i copy it and the java.js file and every thing is ok ,,
I know that this problem is obscure ,,
thanks for you my friend and also it's for you
jooooo
|
|
|
|
|
kindman_nb wrote: i download firebug ,,
But, did you use it ?
kindman_nb wrote: the error is only that the status bar told me that error on page..
If you click on the status bar, you should get a popup with more details. If you set your browser to how all errors, it will give you a popup right away. Any web dev should have this set.
But, if you actually USED firebug and set a breakpoint, you could check if your function was there, if it's being called, what line the error occurs on, etc.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How did you reference the javascript file??
Maybe you could post your code
Please dont paste too much code, just make a little example of a page with your hyperlink calling the js function
I had a problem similar, and the problem was the way i referenced the javascriptfile
Is the directories herarchy the same?? (Relative to the javascript file)
Alexei Rodriguez
|
|
|
|
|
really thanks my friend for your reply ..
I'm new on aps ,,,
AlexeiXX3 wrote: the problem was the way i referenced the javascriptfile
how can i do that ..
jooooo
|
|
|
|
|
|
You might run into problems again when you reference to masterpage from subdirectories
To avoid that, reference the js file in your masterpage as follows:
(Inside Body Tags)
<script src="<%= Me.ResolveURL("filename.js") %>" type="text/javascript"></script>
Alexei Rodriguez
|
|
|
|
|
ASP.Net seems to keep an eye out for some client side changes such as checkboxes, while completely ignoring other stuff. Losing Style.visibity information during postbacks really hurts for example.
Is there a way to make asp remember such changes, or to check them during postback, and set them myself?
|
|
|
|
|
If viewstate is turned on for a control, then changes are remembered. Any non server controls, are not remembered at all.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Viewstate only seems to remember specific changes. Look at the following code, for example.
if (!Page.IsPostBack)<br />
{<br />
string str = "<script type='text/javascript'>";<br />
str += "document.getElementById('CheckBox3').style.visibility='hidden';";<br />
str += "document.getElementById('CheckBox2').checked=true;"; <br />
str += "</script>"; <br />
Response.Write(str);<br />
}
It will add javascript to check checkbox2, and hide checkbox3 on the clicent side if it's not a postback. Now do a postback. Checkbox2 will stay checked, but checkbox3 will turn visible after a postback. Viewstate is enabled for both checkboxes.
|
|
|
|
|
Well, I am surprised it remembers the check, and you're lucky it works at all. This is silly code. Set the Visible and Checked properties on the .NET class instances, and both will be remembered.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
It remembers the check, because that's how any html form remembers the check or textfield data during postback.
Of course this can be done on the server side and be remembered, and probably most examples are silly. This was not the question
Then think of this, as it's more like a real life example: The user can show or hide a div with a button (client side code). This div should not magically appear after a postback if it's hidden or vice versa.
Postback is slow. You don't want to postback and wait just to hide something, to change the backcolor or to sort a table when it can be done instantly on the client side.
|
|
|
|
|
derm2 wrote: Postback is slow. You don't want to postback and wait just to hide something, to change the backcolor or to sort a table when it can be done instantly on the client side.
I agree. But, when I do client side stuff, I don't expect viewstate to find it all, I would tend to use a server hidden control to store values telling me what I had done on the client side in script.
I get what you're saying, viewstate would be cooler if it worked better. I guess I'm just saying I'm glad when stuff works at all :P
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for the input, the hidden field should do the job.
And we shall see what they make for us in the next version of ASP.net 
|
|
|
|
|