|
Yes, this way jsVar will be availeble on the page, and can be accessed in javascript. Since, this variable is declared on page so, its scope will be page.
In case you have two javascript variables that you want to initialized based on you database value, you will have to follow second approach.
By doing this you are generating javascript code on the server side that will be available on the page once loaded.
HTH
|
|
|
|
|
This worked perfectly. As I was writing away a marker for each database record read, I had to make the key (InitJSVar) a string so that I could change the key each time a new record was read ie first record = InitJSVar1, second record= InitJSVar2 ...etc
Many thanks
Will give you 5 rating
|
|
|
|
|
As I said here ~
you can use server-side hidden field to communicate between client-side and server-side.
<input id="Hidden1" type="hidden" runat="server"/>
In Form_load
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
Hidden1.Value = "13";<br />
}
You can set like that..
In Client-side ~
<script language="javascript" type="text/javascript"><br />
function getvalue(){<br />
var var1 = document.getElementById('Hidden1').value;<br />
}<br />
</script><br />
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Thanks for assisting me - I ened up using peacefulmember's solution
|
|
|
|
|
Another Easy option might be to use inline tags. Some people like it some hate it. If you feel that it is cleaner than the other options you can do something like this.
<script type="text/javascript>
.
.
var point = new GLatLng(<%= Lat%>,<%= Lng%>) ;
.
.
</script>
Co-Author ASP.NET AJAX in Action
|
|
|
|
|
Thanks for your help - I ended up using peacefulmember's solution
|
|
|
|
|
For what it's worth, I believe there's an article somewhere on CP where someone wrapped all this google maps stuff into a control which would do all of this. I didn't actually use it, so it may relate to an older version of the API, but I am pretty sure it exists, it's worth looking into.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You already have a thread about this[^] that you created only a few hours ago, where I already have shown you how to do this. Please keep it in a single thread.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks for taking the time to assist me. I ended up using peacefulMember's solution
|
|
|
|
|
You should specify the format when you convert the value to a string. His solution only works for floating point numbers if the current culture happens to use period for decimal separator.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi
i am trying to call 2 different javascript function using
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "OnLoad", "<script>HidePreviousAddressSection()</script>");
and
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "OnLoad", "<script>HideControl()</script>");
But only one javascript function get registered How can we call 2 function as i have to call 2 function after checking some business logic
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Can't you put both functions in the same javascript tag?
this.Page.ClientScript.RegisterStartupScript(this.GetType), "OnLoad", "<script>HidePreviousAddressSection();HideControl();</script>");
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
You can't register two script blocks with the same name. The type and name is used as an identifier for the script, so that different controls can add the same script block without it being repeated.
Just give the blocks different names:
ClientScript.RegisterStartupScript(this.GetType(), "HideAddress", "<script>HidePreviousAddressSection()</script>");<br />
ClientScript.RegisterStartupScript(this.GetType(), "HideControl", "<script>HideControl()</script>");
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Guffa,
Thats why you are called MVP of CP. i really didn't know that 2 paramter is identifier for the script i thought it is the Event after which the script is going to call
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi,
Got a user control in my master page. I want to access the prperty of user control from the main page. How can I do that?
Thanks
<!-- Master Page -->
<%@ Register TagPrefix="ucl" TagName="myCntrl" Src="~/UCL.ascx" %>
<ucl:myCntrl runat="server" />
<!-- User Control -->
Partial Class UCL
Inherits System.Web.UI.UserControl
Priavte x as String = ""
Public Property ConCatStr() As String
Get
Return x & "Color"
End Get
Set(ByVal value As String)
Dim x As String = value
End Set
End Property
End Class
<!-- Main Page -->
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Want to refer controls's ConCatStr property on PostBack
End Sub
|
|
|
|
|
Hi,
I'll put that down in C# as I'm not really familiar with VB.NET exact syntax, sorry.
In the main page load method:
UserControl myMasterControl = (UserControl)this.Master.FindControl("myCntrl");
string myProperty = myMasterControl.ConCatStr;
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
I tried doing what you mentioned. Did not work!
Do I need to assign an ID to the user control? Without that I am not able to findControl on the page.
<ucl:myCntrl runat="server" id="uclCntrl" />
On page load:
Dim ucl As System.Web.UI.UserControl
ucl = Me.Master.FindControl("uclCntl")
Response.Write("Found User control " & (Not ucl Is Nothing) & " !") ' I get True for this
ucl.Test() 'ERROR: Test is not a member of System.Web.UI.UserControl
What is wrong here?
|
|
|
|
|
Hi
I am checking session to in every page load as no one go inside the website without login . n i m using server http://resellerclub.com .My
site is well running on local server . but at host server it
user redirected to default page again n again . some time user can surf 2 or three pages .
what should i do now ?
thanks in advance
regards
saumitra
saumitra@intrawebsolns.com
|
|
|
|
|
saumitratamrakar wrote: what should i do now ?
well for one thing, stop using SMS language and start writing normal English.
Now, can you send some code about how you are checking for the session? and also where is the session stored on the host server? (InProc, StateServer or SQL Server?)
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
I Uploaded my application and I got Following Error ::
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Pls Help me How to Configure the Trust Level
As our Application(ASP.net) Bydefault run under full trust
How we can make it as partially /medium trusted sothat it runs on server
I tried it by doing changes in systems web.config,web_mediumtrusted.config but
not running
Is There simple steps sothat I runs my application on server
swapnil
|
|
|
|
|
To resolve this behavior, grant the FullTrust right to the remote share:
1. On the Web server, open Administrative Tools, and then double-click Microsoft .NET Framework Configuration.
2. Expand Runtime Security Policy, expand Machine, and then expand Code Groups.
3. Right-click All_Code, and then click New.
4. Select Create a new code group. Give your code group a relevant name, such as the name of the applications share. Click Next.
5. In the Choose the condition type for this code group list, select URL.
6. In the URL box, type the path of the share in the following format:
file:////\\computername\sharename\*
Note Replace computername with the name of the computer that is hosting the remote share. Replace sharename with the name of the share.
7. Click Next. On the next page, select Use an existing permission set, and then select FullTrust.
8. Click Next, and then click Finish.
9. Restart Microsoft Internet Information Services (IIS) to restart the ASP.NET worker process.
Hope this will solve your problem.
SSK.
|
|
|
|
|
By doing The steps you said
I trust level of remote share get changed for url get changed by doing the steps
But I have The Application created in full trust i.e (defualt the aspnet sets)
When we upload the application on web server it gives security exception
How can I make changes n web.config file
so that it connects to the web database server
Is there any setting That we have to do from admin panel
swap
|
|
|
|
|
Hello Everyone,
I've created my drop-down menu in Javascript and using this menu in my web Application and running perfectly.
But there is a problem now i've taken a "Dropdownlist" in my project and this "Dropdownlist" hiding my JS menu
Plz suggest me the way so that this "Dropdownlist" being hidden in my JS menu
.............
|
|
|
|
|
Seriously, I haven't got a clue what you're trying to tell us...
Please explain your problem and ask your question in English....
|
|
|
|
|
Eduard Keilholz wrote: Seriously, I haven't got a clue what you're trying to tell us...
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|