Tag: asp.net

My Return false is not working in this code..using jquery

$(function () { $(‘#form4’).submit(function () { var val = $(“#txtNewServiceTypeCategory”).val(); $(“#ServiceTypeCategoryName”).children(“option”).each(function () { var $this = $(this); if (val == $this.val()) { alert(“ServiceTypeCategory Name is already added! Please Choose Differnt Category Name”); return false; } }); $(‘#someHiddenDiv2’).show(); $(‘#STSave’).attr(‘disabled’, ‘disabled’); $.ajax({ url: this.action, type: this.method, data: $(this).serialize(), success: function (result) { $(‘#someHiddenDiv2’).hide(); alert(‘Saved NewServiceTypeCategory Successfully. Thank […]

How to set the position of the ASP.NET Ajax ModalPopupExtender?

Can the position of the Ajax modalpopupextender be set either to an absolute or relative position on the page? The default puts it at page center and I haven’t found a way to override this. I would like to position the popup close to the control that triggers it.

How to get value of selected checkboxlist items using javascript in asp.net

I am working on an asp.net project in which i have a checkboxlist which i have bound using DataTable dt = new Process_Hotels().SelectAllFacilty(); if (dt.Rows.Count > 0) { cblHotelFacility.DataSource = dt; cblHotelFacility.DataTextField = “Facility”; cblHotelFacility.DataValueField = “ID”; cblHotelFacility.DataBind(); foreach (ListItem li in cblHotelFacility.Items) { li.Attributes.Add(“JSvalue”, li.Value); } } and now i want to get selected […]

How can I hide sensitive information in a web page?

I am trying to send a json object that holds quiz data [including answers] from my code behind to javascript. I used… var quizJson = <%=jsonObj%> but the issue is, my users are smart enough to use view source and reveal the answers. Any suggestion? Thanks in advance

how to vote ONCE on website without authentication

I want people to be able to vote on my site, but I don’t like sites that forces registration to do this. So my question is, is the any way to vote up/down, save the votes in a database, and make sure a person can only vote once? Without using cookies, I feel like its […]

How to change Imageurl of imagebutton using javascript?

How to change Imageurl of imagebutton using javascript?

Using Alert in Response.Write Function in ASP.NET

I have database code like this try { string strConnectionString = ConfigurationManager.ConnectionStrings[“SqlServerCstr”].ConnectionString; SqlConnection myConnection = new SqlConnection(strConnectionString); myConnection.Open(); string hesap = Label1.Text; string musteriadi = DropDownList1.SelectedItem.Value; string avukat = DropDownList2.SelectedItem.Value; SqlCommand cmd = new SqlCommand(“INSERT INTO AVUKAT VALUES (@MUSTERI, @AVUKAT, @HESAP)”, myConnection); cmd.Parameters.AddWithValue(“@HESAP”, hesap); cmd.Parameters.AddWithValue(“@MUSTERI”, musteriadi); cmd.Parameters.AddWithValue(“@AVUKAT”, avukat); cmd.Connection = myConnection; SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); […]

Where does ASP.Net get its rendered IDs from?

I’ve inherited a project with some nasty JavaScript that depends on hard coded object ids. i.e. There are lots of places where it does things like this var magazine = document.getElementById(‘repModuleDisplay__ctl3_chkCats_0’); When the page renders in my UAT environment, the HTML looks like this, and everything works OK. <input id=”repModuleDisplay__ctl3_chkCats_0″ type=”checkbox” name=”repModuleDisplay:_ctl3:chkCats:0″ … etc However, […]

How to use asp.net and phantomjs to take a screen shot of a page and return it to the client

I want to be able to read a screen shot of a web site, and am attempting to use phantomjs and ASP.NET. I have tried using page.render which would save the screen shot to a file. It works as a console application, but not when I call it from an asp.net handler. It is probably […]

Relative script path in usercontrol

I have asp.net usercontrol that is including some js script like this <script type=”text/javascript” language=”javascript” src=”../JScripts/JScripts.js”/> The problem is that when I am using this usercontrol in some pages, it works correctly, but when using some pages in another folder structure, it fails with the file not found exception message. Changing js path to ~/JScripts/JScripts.js […]