Click here to Skip to main content
15,888,189 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Dynamically add row by DIV Pin
Richard Deeming16-Feb-17 9:30
mveRichard Deeming16-Feb-17 9:30 
GeneralRe: Dynamically add row by DIV Pin
samflex16-Feb-17 9:39
samflex16-Feb-17 9:39 
GeneralRe: Dynamically add row by DIV Pin
Richard Deeming16-Feb-17 10:12
mveRichard Deeming16-Feb-17 10:12 
GeneralRe: Dynamically add row by DIV Pin
samflex16-Feb-17 10:27
samflex16-Feb-17 10:27 
GeneralRe: Dynamically add row by DIV Pin
samflex16-Feb-17 10:52
samflex16-Feb-17 10:52 
GeneralRe: Dynamically add row by DIV Pin
Richard Deeming17-Feb-17 2:07
mveRichard Deeming17-Feb-17 2:07 
GeneralRe: Dynamically add row by DIV Pin
samflex17-Feb-17 2:53
samflex17-Feb-17 2:53 
QuestionInheriting a Javascript Prototype for Web Usercontrol Pin
HemeshSoni13-Feb-17 5:27
HemeshSoni13-Feb-17 5:27 
I have a Web user control with its Javascript code in a JS file. Here is the code in the JS File.

JavaScript
function CtrlColor() {}

CtrlColor.prototype = {
  Change: function() {
    if (Category == '1') {
      this.pnlSearchClientID.style.backGroundColor = 'Red';
    } else {
      this.pnlSearchClientID.style.backGroundColor = 'Blue';
    }
  }
};



The User Control has a Panel whose color i want to change from a Page. Here is the User Control:

ASP.NET
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="CtrlName.ascx.vb" Inherits="MultiInstanceControl.CtrlName" %>
<asp:Panel ID="pnlSearch" runat="server" Style="background-color: yellow;width: 30px;height: 30px;"></asp:Panel>
<script type="text/javascript" src="CtrlNameJS.js"></script>

<script type="text/javascript">
    function CtrlName <%= me.ClientID %> () {
        this.pnlSearchClientID = <%= pnlSearch.ClientID %> ;
    }

    CtrlName <%= me.ClientID %> = CtrlColor.prototype;
</script>



Category is a Server Side property of the Web Control, which I set in the Markup of the page.

In the Page I have 2 Instances of the above Web user Control.

ASP.NET
<form id="form1" runat="server">
       <div> 1. First Instance
           <uc1:CtrlName ID="CtrlName1" IsMultipleFile="false" Category="1" runat="server" />
           <asp:Button runat="server" ID="btnTest1" Text="Get Value" OnClientClick="return btnTest_ClientClick('1');" />
           <br /> 2. Second Instance
           <uc1:CtrlName ID="CtrlName2" IsMultipleFile="false" Category="2" runat="server" />
           <asp:Button runat="server" ID="Button2" Text="Get Value" OnClientClick="return btnTest_ClientClick('2');" />

       </div>
       <script type="text/javascript">
           var inst1 = null;
           var inst2 = null;


           inst1 = new CtrlName<%= CtrlName1.ClientID %> ();
           inst2 = new CtrlName<%= CtrlName2.ClientID %> ();


           function btnTest_ClientClick(strVal) {
               if (strVal == '1') {
                   inst1.Change();
               } else {
                   inst2.Change();
               }
               return false;
           }
       </script>
   </form>




When I execute this, it throws an error:

CtrlNameCtrlName1 is not a constructor
at this line

inst1 = new CtrlName<%=CtrlName1.ClientID %>();

Any suggestion where I am going wrong?
AnswerRe: Inheriting a Javascript Prototype for Web Usercontrol Pin
Richard Deeming13-Feb-17 8:06
mveRichard Deeming13-Feb-17 8:06 
GeneralRe: Inheriting a Javascript Prototype for Web Usercontrol Pin
HemeshSoni13-Feb-17 17:18
HemeshSoni13-Feb-17 17:18 
AnswerRe: Inheriting a Javascript Prototype for Web Usercontrol Pin
HemeshSoni13-Feb-17 17:25
HemeshSoni13-Feb-17 17:25 
Questionmvc app with angular not working in IIS on 80 port Pin
Member 1103130413-Feb-17 0:17
Member 1103130413-Feb-17 0:17 
AnswerRe: mvc app with angular not working in IIS on 80 port Pin
Nathan Minier13-Feb-17 0:54
professionalNathan Minier13-Feb-17 0:54 
GeneralRe: mvc app with angular not working in IIS on 80 port Pin
Member 1103130413-Feb-17 1:04
Member 1103130413-Feb-17 1:04 
GeneralRe: mvc app with angular not working in IIS on 80 port Pin
Nathan Minier13-Feb-17 1:27
professionalNathan Minier13-Feb-17 1:27 
GeneralRe: mvc app with angular not working in IIS on 80 port Pin
Member 1103130413-Feb-17 2:02
Member 1103130413-Feb-17 2:02 
Questionlooping through an array that has value based on a dice roll. Need to properly calculate the rolls. Pin
Member 1299542011-Feb-17 9:25
Member 1299542011-Feb-17 9:25 
AnswerRe: looping through an array that has value based on a dice roll. Need to properly calculate the rolls. Pin
Richard MacCutchan11-Feb-17 20:45
mveRichard MacCutchan11-Feb-17 20:45 
GeneralRe: looping through an array that has value based on a dice roll. Need to properly calculate the rolls. Pin
Member 1299542012-Feb-17 12:05
Member 1299542012-Feb-17 12:05 
GeneralRe: looping through an array that has value based on a dice roll. Need to properly calculate the rolls. Pin
Richard MacCutchan12-Feb-17 23:05
mveRichard MacCutchan12-Feb-17 23:05 
Questionif (window.location.href.toLowerCase is not working in a Sharepoint site. Pin
RameshLuked9-Feb-17 23:08
RameshLuked9-Feb-17 23:08 
AnswerRe: if (window.location.href.toLowerCase is not working in a Sharepoint site. Pin
Afzaal Ahmad Zeeshan9-Feb-17 23:33
professionalAfzaal Ahmad Zeeshan9-Feb-17 23:33 
AnswerRe: if (window.location.href.toLowerCase is not working in a Sharepoint site. Pin
ZurdoDev10-Feb-17 1:17
professionalZurdoDev10-Feb-17 1:17 
GeneralRe: if (window.location.href.toLowerCase is not working in a Sharepoint site. Pin
Richard Deeming10-Feb-17 2:37
mveRichard Deeming10-Feb-17 2:37 
GeneralRe: if (window.location.href.toLowerCase is not working in a Sharepoint site. Pin
ZurdoDev10-Feb-17 3:04
professionalZurdoDev10-Feb-17 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.