Last post Apr 09, 2017 05:54 PM by raju dasa
Member
17 Points
230 Posts
Apr 09, 2017 07:17 AM|clembo67|LINK
I've an html template.
I need to convert it to asp.net webform webapp with masterpage.
Template large use jquery.
My problem is that in jQuery file code refer html control with id tag and master page change it.
This an example:
in masterpage I've this code
<div id="sidebar_menu" runat="server"> <ul> ..... ...
and in jQuery file
var Sidemenu = function() { this.$body = $("body"), this.$openLeftBtn = $(".open-left"), this.$menuItem = $("#sidebar_menu a") };
So this code work in html file but not in masterpage.
Can you help me?
All-Star
15186 Points
3888 Posts
Apr 09, 2017 10:24 AM|raju dasa|LINK
Hi,
<div> is a web control whose ID is not get changed by asp.net, so you can refer it in jquery.
for server controls (<asp: ...>) you can add ClientIdMode="static" to inform asp.net not change it's Id.
Apr 09, 2017 02:50 PM|clembo67|LINK
But when I put HTML code in masterpage it not work.
Why?
Apr 09, 2017 03:04 PM|raju dasa|LINK
HI,
clembo67 But when I put HTML code in masterpage it not work. Why?
It depends on the order of code placed and when you are calling js code.
Try checking the code in browser's view-source.
Apr 09, 2017 04:17 PM|clembo67|LINK
Ok so the problem was where JQUERY was in the page.
In my masterpage I using ScriptManager control at the end of the page where I founded original code but not work.
If I put original code at the end of the page work
<!-- jQuery --> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/bootstrap.min.js"></script> ....
Apr 09, 2017 05:54 PM|raju dasa|LINK
Glad you resolved the issue.
clembo67 In my masterpage I using ScriptManager control at the end of the page where I founded original code but not work. If I put original code at the end of the page work
Can't say anything without seeing your complete code.
Member
17 Points
230 Posts
JQUERY in masterpage
Apr 09, 2017 07:17 AM|clembo67|LINK
I've an html template.
I need to convert it to asp.net webform webapp with masterpage.
Template large use jquery.
My problem is that in jQuery file code refer html control with id tag and master page change it.
This an example:
in masterpage I've this code
and in jQuery file
So this code work in html file but not in masterpage.
Can you help me?
All-Star
15186 Points
3888 Posts
Re: JQUERY in masterpage
Apr 09, 2017 10:24 AM|raju dasa|LINK
Hi,
<div> is a web control whose ID is not get changed by asp.net, so you can refer it in jquery.
for server controls (<asp: ...>) you can add ClientIdMode="static" to inform asp.net not change it's Id.
rajudasa.blogspot.com || rajudasa-tech
Member
17 Points
230 Posts
Re: JQUERY in masterpage
Apr 09, 2017 02:50 PM|clembo67|LINK
But when I put HTML code in masterpage it not work.
Why?
All-Star
15186 Points
3888 Posts
Re: JQUERY in masterpage
Apr 09, 2017 03:04 PM|raju dasa|LINK
HI,
It depends on the order of code placed and when you are calling js code.
Try checking the code in browser's view-source.
rajudasa.blogspot.com || rajudasa-tech
Member
17 Points
230 Posts
Re: JQUERY in masterpage
Apr 09, 2017 04:17 PM|clembo67|LINK
Ok so the problem was where JQUERY was in the page.
In my masterpage I using ScriptManager control at the end of the page where I founded original code but not work.
If I put original code at the end of the page work
Why?
All-Star
15186 Points
3888 Posts
Re: JQUERY in masterpage
Apr 09, 2017 05:54 PM|raju dasa|LINK
Hi,
Glad you resolved the issue.
Can't say anything without seeing your complete code.
rajudasa.blogspot.com || rajudasa-tech