Tag: asp.net

Passing a string value from c# file to js file

I am trying to pass a string value from c# file to js file. If I try to pass an int value, then I can pass it, but I am unable to pass string value. string value = “abc”; int a=5; TableCell.Attributes.Add(“onclick”, “F1(“+value +”)”); //NOTHING HAPPENS TableCell.Attributes.Add(“onclick”, “F1(“+a +”)”); //Works Perfectly js file function F1(value) […]

Embedding variable in HTML from another c# class

I am new to JavaScript, HTML, C# so bare with me… I am using an ASP.NET framework. Within my welcome page (after a user logs in) I want to customize the paragraph text to include their login information. For example: <p> Welcome to the website! </p> Is what the code would have currently, but what […]

Why this button doesn't cause triple postback?

We have developed a page with a asp.net and debugging it accidentally we have discovered on our page button with the next code on onclik attribute onclick=”__doPostBack(‘ctl00$FormPlace$m_userTaskMarkAsUnreadButton’,”); __doPostBack(‘ctl00$FormPlace$m_userTaskMarkAsUnreadButton’,”);WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(“ctl00$FormPlace$m_userTaskMarkAsUnreadButton”, “”, true, “”, “”, false, false))” It seems that the button do three postbacks but when we click it only cause on postback. With this code […]

How to call JavaScript function in GridView Command Field?

I have return one Javascript function which asks the confirm message to the user. The JavaScript functions is function ConfirmOnDelete() { if (confirm(“Are you sure to delete?”)) return true; else return false; and GridView is like below: <asp:CommandField HeaderText=”Delete” ShowDeleteButton=”True” /> Here I want to call the JavaScript function when user clicking the Delete in […]

javascript drop-down filling

I am populating my dropdown through javascript using ASP.NET, and for that I have taken the help of one of the answers on this site. I used the following code: <script type=”text/javascript”> $(document).ready(function () { alert(“Hi”); var select = document.getElementById(‘<%=ddlItems%>’); var option = document.createElement(“option”); option.value = “1”; option.innerHTML = “Option1”; select.appendChild(option); }); </script> It’s not […]

does not contain using jquery

Below is the function that I am using in jquery function addlnkfieldmkAndyr() { var mymke = $(‘h3:contains(“Make”)’); var mymkeVal= $(‘h3:contains(“Make”)’).closest(“td”).next(); var myyr= $(‘h3:contains(“Year”)’); var myyrVal= $(‘h3:contains(“Year”)’).closest(“td”).next(); } The problem that is there is another field with the name as MakeandYear , so mymkeVal and myyrVal are getting the values from MakeandYear instead of just Make. […]

What is the easiest way to call a C# method from Javascript

I have an LinkButton control which I need to add a c# method to. Currently when I use parse control and add the control to the page it changes the call to javascript and I get undefined. I figure a way around this would be to define a javascript function that would call the c# […]

Javascript error at start

When i start the page it gives me this error. I can press no but then the code doesnt work. the code is how do i fix this error?? by the way the button browse opens the fileupload but that is in c# Thanks in advance. <%@ control language=”C#” autoeventwireup=”true” inherits=”Web_Controls_SOLATDFileChooser, App_Web_ivmyhbca” %> <!–2012-05-11 TP […]

How to hide iframe src

I noticed that all the Facebook applications that running inside an iframe hiding their iframe SRC, instead of the real src there is a “javascript:”””. How can i do that? I want that my iframe will hide the original src thanks!

Page_ClientValidate is undefined in formview

I have validators inside a <asp:formview>, in order to show custom validation I am using if (!Page_ClientValidate(“groupName”)) {} I am getting an error Object Expected. How can I validate client side from the form view? I use Page_ClientValidate for <asp:listview> and there