Tag: asp.net

How to change the value of an asp:textbox from javascript

I have an asp:textbox <asp:textbox ID=”NewName” runat=”server” /> and when a user clicks the “Cancel” button, I want to erase whatever is in that text box by making the value just be “”. If it were a an input field of type text, I could just do this in javascript: document.getElementById(‘NewName’).value= “”; But I can’t […]

Open New Window from aspx page from *any* URL

Is there any way to configure IIS or Web app to automatically open a new window when a hyper link is clicked? My issue isn’t as trivial as it sounds, let me explain… I understand you can use javascript or target=”_blank” in the anchor tag, but I don’t always know when an anchor tag might […]

8 is not less than or equal to 30?

Alright, I’ve got a RangeValidator: <asp:RangeValidator ID=”DateRangeValidator” runat=”server” ControlToValidate=”DateRange” ErrorMessage=”The date range must be at least 1 day, not more than 30, and neither date can be greater than today’s date.” EnableClientScript=”true” MinimumValue=”1″ MaximumValue=”30″ CssClass=”errortext span9 offset2″ Display=”Dynamic” /> And as you can see the minimum is 1 and the maximum is 30. That is […]

How to open a page in a new tab in the rowcommand event of gridview?

I have the following code : protected void gv_inbox_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); if (e.CommandName == “sign”) { Session[“TransYear”] = int.Parse(((HiddenField)gv_inbox.Rows[index].Cells[1].FindControl(“HDN_TransYear”)).Value); Session[“MailNumber”] = int.Parse(((HiddenField)gv_inbox.Rows[index].Cells[1].FindControl(“HDN_MailNumber”)).Value); Response.Redirect(“Signature.aspx”, false); //Response.Write(“<script>”); //Response.Write(“window.open(‘Signature.aspx’,’_blank’)”); //Response.Write(“</script>”); } } I want to open the page in a new tab or window . The commented code do that but when […]

Call C# Function From JavaScript/JQuery In Asp.net webforms

So, i have an aspx page which looks like this: <%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head runat=”server”> <title></title> </head> <body> <form id=”form1″ runat=”server”> <div> </div> </form> </body> </html> I would like to know, how I can write JavaScript (e.g. jQuery) code that will […]

change active item in a card layout. ExtJS

I have a panel using the card layout as follows: var cardpanel = new Ext.Panel( { id: ‘cardPanel’, //title: ‘Card Layout’, region: ‘center’, layout: ‘card’, activeItem: 0, autoDestroy: false, bodyStyle: ‘border-top:0px’, defaults: { border: false }, items: [mediaGrid, mappanel], tbar: [ { id: ‘card-media’, text: ‘Media’, icon: ‘/img/silk/images.png’, width: 50, handler: function () { //switch […]

ASP.Net PostbackURL doesn't work if I put in Javascript Validation

I have a usercontrol in ASP.Net featuring a button that I use to postback. This button also has some Javascript validation that is done before it processes the event. Today I tried to postback to another URL by setting the PostBackURL property of the button. But it didn’t work and the page kept posting back […]

How to hide a validator's error text when the validator is initially enabled

I’ve got the following javascript code, which enables a bunch of validators. ValidatorEnable(document.getElementById(“<%=AddressValidator.ClientID %>”), true); ValidatorEnable(document.getElementById(“<%=CityValidator.ClientID %>”), true); ValidatorEnable(document.getElementById(“<%=CountryValidator.ClientID %>”), true); My problem is that when the validators are enabled with the above code, the error message (i.e. the validation text) is displayed. How can I hide the error message just for this instance when […]

How to manually submit a button in asp.net using javascript?

Using javascript, I want to submit a asp.net button, how can I do this? I know the onclick looks like: javascript:WebForm_DoPostBackWithOptions(new …..); I am also weary because the ID of the control can change.

Javascript error : Message: Expected ')'

I am getting a javascript error below, but I can’t seem to find the problem: *Message: Expected ‘)’ Line: 431 Char: 220 Code: 0 URI: http://mywebsite/CustomerLogin.aspx* Line 431 is this javascript line: <script language=’Javascript’> var varDateNow = new Date(); var varTimeNow = varDateNow.getTime(); var varAlertTime = document.getElementById(‘cphTopContent_AlertTime’).value; if(varTimeNow – varAlertTime < 1500) {alert(‘2’ values you […]