|
Your question makes no sense. If yuo get an error, tell us what it is. Post some code. Tell us what you're trying to do. This is useless. We cannot help you.
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.
|
|
|
|
|
Hi everybody.
Does anybody even IMAGINE why writing this in a RegisterStartupScript block would cause my textbox to lose its value upon postback???
Page.ClientScript.RegisterStartupScript(GetType(),"document.getElementById('" + txtp.ClientID + "').value; "...... etc
txtp.Text = "-1";
Let me say that one more time. I am reffering to the ClientID of "txtp" in a RegisterStartupScript. I merely take the value from it, that's all. And when the page retuns, txtp always has its default value, the one I populate in it, see the next line, when I set -1. But if I comment out that line with the .ClientID, then when the pages posts back, after I repopulate, even if I set -1 to the textbox, I DO GET THE CORRECT number in it, which was entered client-side, before the user presses the submit button.
With .Client ID line uncommented:
1. Load dynamic user control in which txtp is.
2. Set -1, register startup script
3. User writes 2 in the textbox
4. Submit
5. Value in textbox is -1.
WRONG
With .Client ID line commented:
1. Load dynamic user control in which txtp is.
2. Set -1, register startup script
3. User writes 2 in the textbox
4. Submit
5. Value in textbox is 2.
CORRECT
Somebody please help me out here....... I'm way over my head, I don't understand a bit of what is happening, even though I have studied the lifetime of the page and I am loading the control dinamically at the master's page Init.
But even if I messed something up in the lifetime, THIS STILL DOESN'T explain why a silly .Client ID messes everything up! Weird!
|
|
|
|
|
Are you sure of this.
I did this myself
this.ClientScript.RegisterStartupScript(typeof(Page),"scriptblock", "<script>var x = document.getElementById('" + txtp.ClientID + "').value; </script>");
txtp.Text = "-1";
and found 2 on txtp.Text when form is posted back.
I think the problem is every time you post back the form it resets the txtp.Text to -1 as you wrote this in Page_Load event I think.
So please write
If(IsPostBack)return; at the beginning, I think it will work properly..
|
|
|
|
|
Hi and thanks for answering Abhishek! No, this is not an IsPostBack problem. I'm not a beginner. Simply uncommenting that line will make the value reach the server again! That's the weird thing. And it works for you perhaps because you don't have that textbox in a dinamically created User Control. What I'm wondering is WHY EXACTLY uncommenting that sh*tty line makes everything work! I can't believe it!
|
|
|
|
|
Ya.. Is it so.. This is really weird. Love to see the exact scenario. If possible can you share the code with me. We can also place a bug report to Microsoft about that if it really happens...
|
|
|
|
|
hi all,
how to i send xml file to client side and than how to use this xml in javascript?
thanks
|
|
|
|
|
I couldnt get you properly. You need to send an XML, just write that in the Response.
You can use a http handler to get the XML from the server. Just call using AJAX.
You can get the elements of the XML using DomParser.
Check this one
http://www.w3schools.com/Xml/xml_parser.asp
for xml parsing.
|
|
|
|
|
I have a web app with some restricted aspx pages and my security check is being done by the master page of the aspx pages. (not sure if this is a great idea).
my problem is if there is no logged in user or he does have the required rights, i forward to a No-Rights error page.
I want to specify this page relative from web-app root. This is important to have portable code (locally pages are at localhost/Project-Name/Restricted/etc..., while on server they are at host/Restricted/etc...)
Someone suggested the ~ option, but this does not work in code behind - it only works in aspx pages. My security checks, of course, are done in the code behind.
any help?
|
|
|
|
|
|
For the full path use Page.ResolveUrl() , for a relative path (relative to the user's browser) use Page.ResolveClientUrl . Both will take in the ~ format and map it to a real path. If you are in a control, the methods are available from Control as well (Page is a type of Control).
|
|
|
|
|
how to get ip address of host computer in C#
|
|
|
|
|
first google hit[^]
I have an article on this site on how to use google.
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.
|
|
|
|
|
you can try this in c#
Me.TextBox1.Text = System.Net.Dns.GetHostEntry(Request.ServerVariables("REMOTE_HOST")).HostName.ToString
Me.TextBox2.Text = Request.UserHostAddress
------------
knowledge is power, try to obtain it
|
|
|
|
|
Hi..
I am using asp.net/c#.
could u tell me how would i pass textbox value to javascript function,
I have one button and a textbox in my aspx file and if user clicks this button, i want textbox value to pass in javascript function.
Now my javascript function returns boolean value true/false , and how would i retrieve this return value , as I want to show messages accordingly.
thanks
By:
Hemant Thaker
|
|
|
|
|
Passing the textbox is easy - you use document.getElementById to get a reference. The ClientID property on the server side will give you the param you need for that. If you want to 'show messages', your best bet is to make controls visible in the same js, or show a confirm or alert message in your js
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.
|
|
|
|
|
Hi..
I am using vs 2005 and can u guide me How would I debug my javascript function...
thanks
By:
Hemant Thaker
|
|
|
|
|
there is some way to get the text box value
one is to use .ClientId in your asp code like this :
document.getElementById(<% textbox1.ClientId %>).value
or if did`nt help you can do something else
the ClientIds always the same as each other , so you can find the ID by view source of the page !
for example it will be like this :
document.getElemetById('ctl00_ContentPlaceHolder1_textBox1').value
|
|
|
|
|
Hiii..
I am using vs 2005 and can u guide me How would I debug my javascript function...
thanks
By:
Hemant Thaker
|
|
|
|
|
hi
i have deployed my web application in lan computer
but suddenly it is not able to access in lan computer
what i need to check
thanks
|
|
|
|
|
Can you ping the machine that has iis in the machine that you cant access your application ?
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.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Were you accessing it using IP? if so please check if thats changed.
Check IIS is working properly.
|
|
|
|
|
Check if the IIS web site is running or not. Restart the IIS web site if possible.
Also check if network is available between you and server.
|
|
|
|
|
Hi dude i got this same problem.. The solution is check That LAN Machine Firewall... if it is on, then disable it..It will work...
Bye
SureshKumar.S
sureshkumaran
|
|
|
|
|
Yes. . Agreed. This is the primary requirement. Need to exempt the http ports from the firewall to reach the server.
Its the most basic requirement, Indeed.
|
|
|
|
|
in gridview i want show just 7 rows, how can i set this property?
|
|
|
|