Advertisement

04.20.2008 at 09:20PM PDT, ID: 23338578
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

in javascript -- how do you call this code from server-side (aspx)

Tags: c#, asp.net 2.x, visual studio 2008 pro, sql 2005 server, iis 6
in javascript -- how do you call this code from server-side (aspx)

document.getElementById('DropDownList_DiscountEarlyYears').style.visibility = 'visible';
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: amillyard
Solution Provided By: kirankumar_goura
Participating Experts: 1
Solution Grade: A
Views: 18
Translate:
Loading Advertisement...
04.21.2008 at 06:56AM PDT, ID: 21401758

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 07:01AM PDT, ID: 21401811

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 07:07AM PDT, ID: 21401869

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 07:11AM PDT, ID: 21401935

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 08:40AM PDT, ID: 21403028

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 08:45AM PDT, ID: 21403084

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 09:42PM PDT, ID: 21408140

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 09:51PM PDT, ID: 21408164

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 11:42PM PDT, ID: 21408536

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 11:53PM PDT, ID: 21408582

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.22.2008 at 12:01AM PDT, ID: 21408610

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.22.2008 at 12:09AM PDT, ID: 21408637

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
04.21.2008 at 06:56AM PDT, ID: 21401758
Inside Page_Load method, put the following code ...
protected void Page_Load(object sender, EventArgs e)
{
// Define the name and type of the client scripts on the page.
String csname = "ButtonClickScript";
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
// Check to see if the client script is already registered.
if (!cs.IsClientScriptBlockRegistered(cstype, csname)){
StringBuilder cstext2 = new StringBuilder();
cstext2.Append("<script type='text/javascript'>");
cstext2.Append("document.getElementById('DropDownList_DiscountEarlyYears').style.visibility = 'visible';");
cstext2.Append("</script>");
cs.RegisterClientScriptBlock(cstype, csname, cstext2.ToString(), false);
}}

 
04.21.2008 at 07:01AM PDT, ID: 21401811
kirankumar_goura:  I have noticed now that when this control is made invisible -- another javascript is not working (i.e. calculating a figure using a few control boxes ocntent values) -- when I make the control visible again, it works.

why would this be so?
 
04.21.2008 at 07:07AM PDT, ID: 21401869
If you post the code, I can help you out.
 
04.21.2008 at 07:11AM PDT, ID: 21401935
kirankumar_goura:  thats great, thanks :-) .... I am just going into meeting for about an hour or so, will post very soon after that.
 
04.21.2008 at 08:40AM PDT, ID: 21403028
the javascript formula that is used, attached.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
function calculateTheNewMortgage() 
{
    // Calculate LTV     
         
    var EstimatedValuationAmount   = parseInt(document.getElementById('TextBox_EstimatedValuationAmount').value);
 
    if( isNaN(EstimatedValuationAmount) )
    EstimatedValuationAmount = 1;     
        
    var OutstandingAmount1stCharge = parseInt(document.getElementById('TextBox_OutstandingAmount1stCharge').value);
    
    if( isNaN(OutstandingAmount1stCharge) )
    OutstandingAmount1stCharge = 0;
    
    var OutstandingAmount2ndCharge = parseInt(document.getElementById('TextBox_OutstandingAmount2ndCharge').value);
    
    if( isNaN(OutstandingAmount2ndCharge) )
    OutstandingAmount2ndCharge = 0;
    
    var OutstandingAmount3rdCharge = parseInt(document.getElementById('TextBox_OutstandingAmount3rdCharge').value);
    
    if( isNaN(OutstandingAmount3rdCharge) )
    OutstandingAmount3rdCharge = 0;
        
    var ExtraMoneyHowMuch          = parseInt(document.getElementById('TextBox_ExtraMoneyHowMuch').value);
 
    if( isNaN(ExtraMoneyHowMuch) )
    ExtraMoneyHowMuch = 0;
           
    var OutstandingAmountsTotal = OutstandingAmount1stCharge
                                + OutstandingAmount2ndCharge 
                                + OutstandingAmount3rdCharge 
                                + ExtraMoneyHowMuch;
    
    var LTVSubTotal = OutstandingAmountsTotal / EstimatedValuationAmount;
    
    var LTV = LTVSubTotal * 100;
    var LTVTotal = round_decimals(LTV, 2)
    
    document.getElementById('TextBox_LTV').value = LTVTotal;
    
    // Calculate Total Loan Required
    
    var HowMuch1stCharge = parseInt(document.getElementById('TextBox_HowMuch1stCharge').value);
    
    if( isNaN(HowMuch1stCharge) )
    HowMuch1stCharge = 0;
    
    var HowMuch2ndCharge = parseInt(document.getElementById('TextBox_HowMuch2ndCharge').value);
    
    if( isNaN(HowMuch2ndCharge) )
    HowMuch2ndCharge = 0;
    
    var HowMuch3rdCharge = parseInt(document.getElementById('TextBox_HowMuch3rdCharge').value);
    
    if( isNaN(HowMuch3rdCharge) )
    HowMuch3rdCharge = 0;
    
    var TotalLoanRequired = OutstandingAmount1stCharge 
                          + OutstandingAmount2ndCharge 
                          + OutstandingAmount3rdCharge 
                          + HowMuch1stCharge 
                          + HowMuch2ndCharge 
                          + HowMuch3rdCharge 
                          + ExtraMoneyHowMuch;
    
    document.getElementById('TextBox_LoanRequired').value = TotalLoanRequired;
}
 
function round_decimals(original_number, decimals) 
{
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    
    return pad_with_zeros(result3, decimals)
}
 
function pad_with_zeros(rounded_value, decimal_places) 
{
    var value_string = rounded_value.toString()
    var decimal_location = value_string.indexOf(".")
 
    if (decimal_location == -1) 
    {
        decimal_part_length = 0
        value_string += decimal_places > 0 ? "." : ""
    }
    else 
    {
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) 
    {
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
    }
    return value_string
}
Open in New Window
 
04.21.2008 at 08:45AM PDT, ID: 21403084
one of the controls block, attached.

TextBox_ExtraMoneyHowMuch is one of a few controls on page that the javascript works with.

basically, use the radio to indicate, yes or no -- if yes selected, then the rest of the above controls appear, enabling user to enter relevant values.  if no selected, then the panel is closed (hide) from user.

when any of the controls are hidden, this breaks the javascript calculation.

am I working on this the correct way, or is there a different approach I should be considering.

note: the user can update any of the input fields, and the calculations should be reperformed instantly and displayed to user.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
<div class="cssbox_body_fb" style="text-align: left">
                    <span style="font-family: Verdana"><span style="color: black">
                        <span style="font-size: 10pt; font-family: 'Arial Unicode MS'">
                    <span lang="en-gb">L</span>ooking for any
                            extra money other than to consolidate any loans or outstanding credit ?<b>
                    <span lang="en-gb">&nbsp; </span></b>&nbsp;
                        <asp:RadioButton ID="RadioButton_ExtraMoneyNo" runat="server" Font-Names="Arial Unicode MS"
                            Font-Size="9pt" GroupName="ExtraMoney" Text="No" Checked="True" 
                        AutoPostBack="True" 
                        oncheckedchanged="RadioButton_ExtraMoneyNo_CheckedChanged" />
                    <span lang="en-gb">&nbsp;</span><asp:RadioButton ID="RadioButton_ExtraMoneyYes" 
                        runat="server" Font-Names="Arial Unicode MS"
                            Font-Size="9pt" GroupName="ExtraMoney" Text="Yes" 
                        AutoPostBack="True" 
                        oncheckedchanged="RadioButton_ExtraMoneyYes_CheckedChanged1" />
                    <br />
                    </span>
                    <asp:Panel ID="Panel_ExtraMoney" runat="server" Visible="False">
                        <span style="font-family: Verdana"><span style="color: black">
                        <span style="font-size: 10pt; font-family: 'Arial Unicode MS'">
                        <br />
                        </span><span style="font-size: 10pt">
                        <span style="font-family: '@Arial Unicode MS'">How much&nbsp; £ </span></span>
                        <asp:TextBox ID="TextBox_ExtraMoneyHowMuch" 
    runat="server" Font-Names="Arial Unicode MS"
                            Font-Size="9pt" Width="70px" MaxLength="10" 
                        onchange="calculateTheNewMortgage()" 
                        onkeypress="return numeralsOnly(event)" 
    CssClass="RightToLeftBox"></asp:TextBox>
                        <span lang="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <span style="font-size: 10pt; font-family: 'Arial Unicode MS'">Purpose of Loan&nbsp;</span>
                        <asp:DropDownList ID="DropDownList_PurposeOfLoan"
                                runat="server" 
    DataSourceID="SqlDataSource_PurposeOfLoan" DataTextField="PurposeOfLoanName"
                                DataValueField="PurposeOfLoan_ID" Font-Names="Arial Unicode MS" 
                        Font-Size="9pt">
                        </asp:DropDownList>
                        </span>
                        <br />
                        </span></span>
                    </asp:Panel>
                        <br />
                    </span></span>
                </div>
Open in New Window
 
04.21.2008 at 09:42PM PDT, ID: 21408140
I don't see anything wrong in your approach.

If you make a panel invisbile, then all the controls kept on the panel become hidden. To resolve this, set its Enabled Propery to True.

If you're not OK with my solution, wait for another expert opinion.
 
04.21.2008 at 09:51PM PDT, ID: 21408164
Correction: set Panel's Enabled Propery to False.
 
04.21.2008 at 11:42PM PDT, ID: 21408536
kirankumar_goura: set Panel's Enabled Propery to False -- instead of using the visible option?  -- or set both?
 
04.21.2008 at 11:53PM PDT, ID: 21408582
set Panel's Enabled Propery to False -- instead of using the visible option
 
04.22.2008 at 12:01AM PDT, ID: 21408610
ok, this will just 'grey-out' the control (i.e. make in non-clickable), right ?  

keeping the control visible will alter the look and feel and make the form unncesseassrily complicated to the user (as many different options are available, depending on what has been previously selected).

is there a way for javascript to utilise a server-sire variable perhaps?  -- so the calculation is then performed on those variables as opposed to the web-page controls....which means I could pass the variable across (from web-page to server-side when a number field has been updated).

as all calculations would be non web-page control bases, but server-side code, the javascript would not fail as a visible or non-visible would not affect the calculations etc.

is this possible somehow?
 
04.22.2008 at 12:09AM PDT, ID: 21408637
ok, this will just 'grey-out' the control (i.e. make in non-clickable), right ?   >>>>>>>.
yes, it till 'grey-out' the control which changes the look and feel.

is there a way for javascript to utilise a server-sire variable perhaps?  >>>>>>>>>>>
Try this out. Use FindControl("ControlID") inside the javascript function.
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628