Bind control to JavaScript file - c#

I had JavaScript slide show which had Image and text .But I want to mange js code to retrieve it's data(image, text) from database by code .please anyone help more it more difficult.
aspx page:
<form id="form1" runat="server">
<div class="hom_scrooler_con tm10 "><script type="text/javascript" src="js/scroller.js"></script>
<div class="hom_but_a "><img src="images/home-bu_pro.jpg" alt="#" name="Image9" width="134" height="34" border="0" id="Image9" /></div>
<div class="hom_but_a"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','images/home-bu_news.jpg',1)"><img src="images/home-bu_npro.jpg" alt="#" name="Image8" width="134" height="34" border="0" id="Image8" /></div>
<div class="hom_but_a"><img src="images/home-bu_news.jpg" width="134" height="34" border="0" /></div>
</div>
</form>
JS:
sts_bs("jwscroller2dbd",[20080623,"images/","","blank.gif",0,1,0,50,"50%","left",2,3,298,199,1,10,0,0,0,2000,1,12,2,
"stEffect(\"scroll(Rate=24,enabled=0,Duration=0.50)\")",-2,60],["none",1,"#454545","transparent","","no-repeat"]);
sts_sca(["center","middle","center","middle"],["aro-lft.png","aro-lftr.png","arrowl_gray.gif",56,55,"aro-rt.png","aro-rtr.png","arrowr_gray.gif",55,51]);
sts_tbd([1],["solid",1,"#454545",5,"round_tl.gif","round_tr.gif","round_br.gif","round_bl.gif","transparent","round_t.gif",
"repeat","transparent","round_r.gif","repeat","transparent","round_b.gif","repeat","transparent","round_l.gif","repeat"]);
sts_ai("i0",[0,"New Sharp Copiers Now 2\r\n\r\nHas been the industry\'s standard dummy text ever
when an unknown printer.Simply dummy text of","#","_self","media3_07.png",298,197,"left"],["transparent"
,"bold 10pt Verdana,Arial","#666666","none","bold 10pt Verdana,Arial","#666666","none"]);
sts_ai("i1",[,"New Sharp Copiers \r\n\r\nHas been the industry\'s standard dummy text ever when an unknown printer.Simply
dummy text of",,,"media3_08.png"],[,,,,"italic bold 10pt Verdana,Arial"],"i0","i0");
sts_es();

Don't use JavaScript to connecto to a database. If you want to get data from a database, use jQuery and AJAX to get data from a .Net Web Service. It's pretty simple, and reusable.
You can build your own AJAX controls without jQuery, but I wouldn't...

Related

ASp.net Webform multiline textbox adds line break on page load automatically

From last one/two weeks i am noticing that any multiline textbox that i am using in asp.net web-form based website adds line-break to textbox automatically.
This has never happened before i ma facing this issue with almost all asp.net webform websites
<textarea name="txtComment" rows="2" cols="20" id="txtComment" tabindex="4" class="comment-box">
</textarea>
I am not sure why this is happening. It gets bad when we update the page & if we dont manually remove line breaks it will keep on adding linebreak to multiline textbox. I am not sure if this issue is due to some windows update or browser. It happens in Firefox & later i noticed same in Chrome?
Not sure why this is happening
Example: Code
<asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" Rows="3"> Line </asp:TextBox>
</div>
</form>
HTML Rendered Output
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title></head>
<body>
<form method="post" action="./TESTMultiline.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNjQ0NTE4MDYwZGRecdSIl8wWZzLW33b1SXrfQmgMkA==" />
</div>
<div>
<input name="TextBox1" type="text" id="TextBox1" />
<textarea name="TextBox2" rows="3" cols="20" id="TextBox2">
Line </textarea>
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="F8195D5B" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAN9qVvxr9edjD9ICF1fyY9rESCFkFW/RuhzY1oLb/NUVB2nXP6dhZn6mKtmTGNHd3PbNvMJfATDdpnltdJAG8xg/EABZA==" />
</div></form>
<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
{"appName":"Firefox","requestId":"b33e31c27a494a9c8d0d82b3f5432ca7"}
</script>
<script type="text/javascript" src="http://localhost:61571/7d590f801da8489ebffe28d952f8f4af/browserLink" async="async"></script>
<!-- End Browser Link -->
</body>
</html>
OUTPUT
The problem is related to the way the TextBox Control is being rendered. Changing the value for controlRenderingCompatibilityVersion in web.config did the trick for me:
controlRenderingCompatibilityVersion=4.5
The information is from the question Extra characters added to multiline textbox, answer from JTapp/jmoreno.
just remove
from this row
<textarea name="TextBox2" rows="3" cols="20" id="TextBox2"> Line </textarea>
Two options:
Remove the space before the "_Line" in your source code: probably an unwonted character is 'hiding' there
Try remove text all together - and adding it in the code behind: TextBox2.Text = "Line";
Edited:
Open Chrome dev tool and check all css/classes/styling that effects this tag

Jquery ui Progressbar for every postback in asp.net

Can you help me on how to use Jquery UI Progress bar for every postback in asp.net? I really don't know how to start I'm new to Jquery UI. I have an UpdateProgress but it doesn't work on my jquery ui dialog so I wanted to try Jquery UI Progress bar. Any suggestion will be helpful! Thank you.
So far I have this code for the progressbar i don't know how to make it work like the UpdateProgress.
$(function() {
$( "#progressbar" ).progressbar({
value: false
});
ASP:
<div id="progressbar">
</div>
this is my existing code that does not work in my button inside of Jquery UI dialog.
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div class="modal">
<div class="center" align="center">
Processing Data, Please wait..
<img alt="" src="images/loader.gif" />
</div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>

How can I Insert an Umbraco Item in to a url in a cshtml file, razor?

I've made an If statement containing a youtube link.
In umbraco I have a Text String box that enables a user to insert the ID of a youtube video.
<div class="module m-video">
<div class="regular">
<div class="graphics video-container">
<iframe width="100%" src="http://www.youtube.com/embed/<umbraco:Item field="youtubeId" runat="server" />?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
But when the page loads it displays the <umbraco:Item field="youtubeId" runat="server" /> instead of what the user put in.
What work around is their to display what a user inserts into the text string box.
All must be done in razor
I would create a "YoutubeVideo" macro along with it's razor script "YoutubeVideo.cshtml". And that cshtml code would look like this:
#using umbraco.MacroEngines
#inherits umbraco.MacroEngines.DynamicNodeContext
<div class="module m-video">
<div class="regular">
<div class="graphics video-container">
<iframe width="100%" src="http://www.youtube.com/embed/#Model.youtubeId?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
Then in your .master you could include that mascroscript like this:
<umbraco:Macro ID="Macro1" Alias="YoutubeVideo" runat="server" />
This approach may differ if you are using Umbraco 6+ with MVC, but otherwise this should do the trick.
If you are doing this inside the umbraco template editor you should be able to swap the double quotes denoting the src attribute with single quotation marks, and the umbraco item needs no change.
<iframe width="100%" src='http://www.youtube.com/embed/<umbraco:Item field="youtubeId" runat="server" />?rel=0' frameborder="0" allowfullscreen></iframe>

iFrame IE8 using jQuery ColorBox

I am using the JQuery ColorBox with inline content that seems to work fine in most browsers, however when I use it in IE8 it loads fine the first-time then after that the iFrame part of the content doesn't show?
I have checked the source and the iframe is rendered in the html correctly. I am using asp.net 3.5 and c# for the server-side.
Server-Side code:
<script>
jQuery(document).ready(function () {
jQuery.fn.colorbox({ width: 376, inline: true, href: "#LightBox" });
});
</script>
<div style='display:none'>
<div id='LightBox' style='padding:10px; background:#fff;'>
<sc:Image runat="server" ID="imgBanner" Field="Banner" MaxWidth="346" />
<sc:Text runat="server" ID="txtContent" Field="Content" />
<iframe runat="server" id="iFrm" height="220px" scrolling="no" frameborder="0" />
<img src="/images/loading.gif" alt="loading" id="preload-img" />
</div>
</div>
Client-Side:
<div style='display:none'>
<div id='LightBox' style='padding:10px; background:#fff;'>
<img src="~/media/Images/Premier/newsletters/ignite/header_4.ashx?mw=346" alt="Ignite" width="346" height="132" />
<p><strong>Free e-newsletter from Premier</strong> </p>
<p>Hot topics impacting your life today...</p>
<p>You are invited to receive <strong>Ignite</strong>, the UK's leading Christian <br />e-publication,
dealing with the hottest issues of our day: from abortion, to going 'green', to the debate over homosexuality.</p>
<p>To receive your free weekly subscription to <strong>Ignite</strong> fill in your details below.</p>
<iframe id="content_10_iFrm" height="220px" scrolling="no" frameborder="0" src="http://email.premierchristianmedia.co.uk/premierradiolz//WebCapture.aspx?pID=334&t=0"></iframe>
<img src="/images/loading.gif" alt="loading" id="preload-img" />
</div>
</div>
Until a fix is found, you can make IE8 emulate IE7 by adding this meta tag to the head section of your page
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">

Jquery accordion with repeater, row details are not visible when activating row

I am trying to use the jquery accordion with a repeater. I used the sample directly from the jquery documentation. When I click on the section links, the details open and expand, but you can't see any of the text. The html output looks right to me, not sure where this is going wrong.
<script>
$(document).ready(function () {
$("#accordion").accordion();
});
</script>
<div id="accordion">
<asp:Repeater ID="respondToExceptionsList" runat="server">
<ItemTemplate>
<h3>Section 1</h3>
<div>
sdfffffffffffffff
</div>
</ItemTemplate>
</asp:Repeater>
</div>
This is the html output.
<DIV id=accordion class="ui-accordion ui-widget ui-helper-reset ui-accordion-icons" role=tablist jQuery1315324170464="2">
<H3 aria-expanded=true class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top" role=tab tabIndex=0 jQuery1315324170464="3">
<SPAN class="ui-icon ui-icon-triangle-1-s" jQuery1315324170464="13"></SPAN><A tabIndex=-1 href="#">Section 1</A></H3>
<DIV style="HEIGHT: 19px" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" role=tabpanel>sdfffffffffffffff </DIV>
</DIV>
This is related to the accordion height being set to zero. I am having the same issue using the accordion in an html repeater generated using angularjs. To fix the problem, the accordion must be refreshed after the data is loaded. I found the answer in the jquery forums here.

Categories