Javascript Code Not Working?
Jan 19, 2010<script language="JavaScript" type="text/javascript">
if (location.href.indexOf('?dest=') > 0)
window.open('/about.aspx', '', '')
</script>
how do i make this work. Its in aspx file.
<script language="JavaScript" type="text/javascript">
if (location.href.indexOf('?dest=') > 0)
window.open('/about.aspx', '', '')
</script>
how do i make this work. Its in aspx file.
I wanted to disable a button after it is clicked and at the same time fire the post back event to generate a report. My first set of code did not work because soon after the button is disabled the page won't submit/post back. here's the first set of code which was not implemented. the onclientclick calls a javascript function which has these lines
document.getElementById('btnGenerateReport').disabled=true;
GetPostBackEventReference(btnGenerateReport,'');
since it was not posting back,i tried the following on page_load code behind
btnGenerateReport.Attributes.Add("onclick", "this.disabled=true;" + ClientScript.GetPostBackEventReference(btnGenerateReport, ""))
that worked well. but I tried to copy the javascript that got generated and pasted directly on design view
onclick="this.disabled=true;__doPostBack('btnDownloadClientsWithConviction','');"
its not working from client side alone after I disable the code behind attributes.add
but when I check the view source the 2 pages are the samewhy am I not able to move the code from code-behind to design view?
I've a very complete site in ASP.NET wich uses iframes. I'm working to change an old control we'd been using to show dialogs to use jQuery UI dialogs. I'm also making sure everything works well in IE9.
The fact is: the script I've in the pages shown in iframes is not working in IE9. Why? Because Object, Array and String are undefined. There may be some others issues, I've seen only this ones.
There is no chance (because a lot of reasons) to stop using iframes on some dialogs. And I'd rather not to use the meta tag to force IE8 Compability. Does anyone know any way to fix this uggly bug in IE9?
Edit
Here there's some info that may be helfull:
jQuery code for the iframe in a plugin I've made to config jQuery UI dialog:
options.content = $("<iframe>")
.attr("src", options.intSrcIframe)
.attr("frameborder", 0)
.attr("scrolling", options.intIframeScrolling)
.css("background-color", options.intBgColorIframe)
.attr("height", "100%")
.attr("width", "100%");
_this.html(options.content);
This is my code for making textbox accept number only.
<asp:TextBox ID="txtRotationNo" runat="server" onkeydown="return NumberOnly();" CssClass="textbox"></asp:TextBox>
function NumberOnly () {
if(!(event.keyCode>=48 && event.keyCode<=57) && event.keyCode!=8) {
event.returnValue=null;
}
}
This code is working in Chrome and Opera, but not in firefox.
I am using vs2008 pro. my problem is that javascript debugger is not working on mozila firefox but working fine on IE8.
View 1 RepliesWindow.open javascript function is not working in Mozilla, but working in other browsers, here is what I have write.
<a href="javascript:window.open('../Terms.aspx','Terms','width=550,height=400')">
click here</a>
Actually what happened in Mozilla is popup is opened but parent window is blank with [object Window]
My application is working fine in local environment but not working after push code in live. My locale environment and hosting environment both are having same configuration. Same app working fine 2 month before but in different domain but same hosting server.
how to check the both config / any possible to run debug mode in hosting server please let me know. below code used in all page for checking user session status but when I click on any link page redirect to login.aspx I think session got timeout. I don't know why session got time frequently, but this issue not happening in local environment (desktop).
[Code]....
[Code]....
If Not IsDBNull(ext) Then
ext = LCase(ext)
End If
Select Case ext
'Case ".htm", ".html"
' type = "text/HTML"
'Case ".txt"
' type = "text/plain"
'Case ".doc", ".rtf"
' type = "Application/msword"
'Case ".csv", ".xls"
' type = "Application/x-msexcel"........................
Description:- hello code given below is working fine in i.e. and other but not working in all mozila version.javascript is simple to devide two textbox's value. you can easily understand.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="javascript_test.aspx.cs" Inherits="javascript_test" %>
<!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" >
<script type ="text/jscript">
var _txtamount;
var _txtins;
var _txtinsamount;
[code]....
how do you call code behind button click event or a code behind method
from javascript.
I have an asp.net button, that when clicked calls a code behind function. The function does some evaluation, and then I want to call javascript from within this asp.net function.
View 2 Replieswe are working on one of our site which is having lots of javascript code.but while testing one of our tester has disabled javascript in browser.so in this scenario javascript code is not working properly. So can any one let me know is thr any work around to run javascript code while browser javascript is disabled.
View 1 RepliesThis program in asp.net 2.0 is a Spanish/English Dictionary.
It consists of two textboxes,one button and a datalist. The datalist is bound to an acces database consisting of two columns; One Spanish and one English. When a user enters a Spanish word in textbox1 and clicks the button, the meaning of the word appears in textbox2. Now sometimes a user enters a word that is not in the database. I want, in this case, to have a javascript messagebox to popup saying “Either the word is not listed or misspelled”.
I tried several javascripts to popup in code behind but that did not work. I know that a clientside should be included but I am not able to do that.
The sub below is the one I am using to fetch the words and it is working perfect as long as I enter a word that is already in access database. The words in the rows in database are separated by hyphens so I am using a “Split” fuction which is also working perfectly.
[code]....
i have a popup that is getting displayed when Save button is clicked. The popup has 2 buttons. Yes and No. No should cancel the popupand yes should take you to function in the code-behind say, btnSave_Click(object sender, Eventargs e). How is it possible.
Below is the code where i am showin the popup.
[code]....
I have a website that shows images people have uploaded.
[URL]
I want to be able to show a popup window when i move the cursor over an image. It should show information about the user that i take from the database.
I have found a javascript that works, it fades a window in and out. But i cant call it from codebehind.
My default.aspx has this code:
Code:
[code]....
this is the code for menu CSS code. It will work on Firefox but not in IE6.
.menu li a:hover .menu ul li:hover a{
background-image:url(images/ye.jpg);
color:#000000;
text-decoration:none;
}
if (e.Row.RowType == DataControlRowType.DataRow)
{
// if no link are presen the cell,
[code]...
Its regarding send mail via c#.net. The following code is working well in my local machine, upload it in server but its not working in server. I m using same smtp server name , email username , password in local and server. But i don't know what is problem? problem is in my coding?
System.Net.Mail.MailMessage objEmail = new System.Net.Mail.MailMessage();
objEmail.From = new MailAddress(dsAdmin.Tables[0].Rows[0]["Emailusername"].ToString());
objEmail.To.Add(To_Tmail.ToString());
objEmail.IsBodyHtml = true;
objEmail.Subject = Subject.ToString();
objEmail.Body = message.ToString() + dsAdmin.Tables[0].Rows[0]["Emailsignature"].ToString();
SmtpClient client = new SmtpClient();
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(dsAdmin.Tables[0].Rows[0]["Emailusername"].ToString(), dsAdmin.Tables[0].Rows[0]["Password"].ToString());
client.UseDefaultCredentials = false;
client.Credentials = SMTPUserInfo;
client.Host = dsAdmin.Tables[0].Rows[0]["SMTPservername"].ToString();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Port = 587;
try
{
client.Send(objEmail);
res = true;
catch (Exception exc)
{
res = false;
}
i have sp in sql server 2000 naed as get_job_by_jobType and it execute as returning table rows and get thedata in sql datasouce and i want to bind it on gridview,and i m executing storedprocedure on the basis of selectitem from dropdownlist.please tell me hwo to write code in code behind
Code:
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Response.Write(DropDownList1.SelectedItem.Text)
' Me.GridView1.DataSource = DataSourceID
Me.GridView1.DataSourceID = Me.SqlDataSource4.ToString()
End Sub
above statment giving me errors(exception)
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" 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">
[code]....
no alert box is displayed when i left the textbox blank and clicked the button
Ok so I have my aspx pages. They work and display fine in IE, but dont do a think in FF. Perfect example is the home page, it has a large image that is set a url that is retrieved from my db in the code behind:
// add main image of home page
imgMain.ImageUrl =
DAL.imagePath();
[Code]....
I've made a login page but I seem to have missed something and I guess I've become blind to the code because I can't find what's wrong with it. I'm sorry some of it's in swedish. There's no error message when I test the login, the program just stays on the login page.
Login page (aspx.cs):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.IO;
public partial class Start : System.Web.UI.Page
{
string config = System.Configuration.ConfigurationManager.ConnectionStrings["InteraktivaFĂreningenConnectionString1"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
this.TextBoxAnvändarnamn.Focus();
}
protected void ButtonLoggaIn_Click(object sender, EventArgs e) //login-button
{
//kontroll av användarnamn och lĂsenord - controls username and password
try
{
SqlConnection conn = new SqlConnection(config);
{
conn.Open();
string Användarnamn = this.TextBoxAnvändarnamn.Text; //username
string LĂsenord = this.TextBoxLĂsenord.Text; //password
string sql = "SELECT Login.anvandarnamn, Login.losenord, Medlem.ID FROM Login, Medlem WHERE anvandarnamn = '" + Användarnamn + "' AND '" + Session["användarnamn"] + "'";
SqlCommand comm = new SqlCommand(sql, conn);
SqlDataReader dr = comm.ExecuteReader();
{
try
{
dr.Read();
if (Convert.ToString(dr["anvandarnamn"]) == Användarnamn) //username
{
Session["användarnamn"] = TextBoxAnvändarnamn.Text; //username
Session["medlemID"] = dr["medlemID"].ToString(); //memberID
if (Convert.ToString(dr["losenord"]) == LĂsenord)
{
HämtaID(); //getID
Response.Redirect("MĂten.aspx");
}
else
{
string scriptet = "<script>alert('LĂsenordet är felaktigt. Prova igen');</script>"; //wrong password
ClientScript.RegisterStartupScript(scriptet.GetType(), "FelLĂsen", scriptet);
TextBoxLĂsenord.Focus();
}
}
}
catch (Exception)
{
string scriptet = "<script>alert('Användarnamnet är felaktigt. Prova igen.');</script>"; //wrong username
ClientScript.RegisterStartupScript(scriptet.GetType(), "FelAnvändarnamn", scriptet);
TextBoxAnvändarnamn.Focus();
}
dr.Close();
conn.Close();
}
}
}
catch (Exception)
{
}
}
//gets and creates session variables of username and memberID
public void HämtaID() //getID
{
try
{
SqlConnection conn = new SqlConnection(config);
{
conn.Open();
string Användarnamn = this.TextBoxAnvändarnamn.Text; //username
string sql = "SELECT fornamn, efternamn, ID FROM Medlem WHERE ID = '" + Session["medlemID"] + "'";
SqlCommand comm = new SqlCommand(sql, conn);
SqlDataReader dr = comm.ExecuteReader();
{
while (dr.Read())
{
Session["medlemID"] = dr["medlemID"].ToString(); //memberID
Session["användarnamn"] = dr["fornamn"].ToString() + " " + dr["efternamn"].ToString(); //username
}
}
dr.Close();
conn.Close();
}
}
catch (Exception)
{
}
}
}
This code is working in firefox but on IE 8 it returns nothing
<script type="text/javascript">
$(document).ready(function(){
var pageUrl = '<%=ResolveUrl("~/test/test.aspx")%>';
// Test
$('#<%=ddlTest.ClientID%>').change(function(){
var trgId = $(this+'input:checked').val();
$.ajax({
type: "POST",........
I have the following entries in the css file.
a.intervalLinks { font-size:11px; font-weight:normal; color:#003399; text-decoration:underline; margin:0px 16px 0px 0px; }
a.intervalLinks:link { text-decoration:underline; }
a.intervalLinks:hover { text-decoration:none; }
a.intervalLinks:visited { text-decoration:underline; }
a.selectedIntervalLink { font-size:12px; font-weight:bold; color:#003399; text-decoration:none; margin:0px 16px 0px 0px; }
a.intervalLinks:active { text-decoration:underline; font-size:large ; }
Edited for trial:
a.big-link:link{}
a.big-link:visited {}
a.big-link:hover{}
a.big-link:active{font-size:1em;}
Whenever i take the click on some links (not shown) which is embedded in the webpage ..i can see the change in the link
a.intervalLinks:active { text-decoration:underline; font-size:large ;
(the font of the link will become large)
but after clicking the page refreshes ..the changes will go away
i want to keep the change for ever in that link ...even there is a page refresh
i understood that ..this can achieved only throughg the code behind of asp.net
Following code should work:but unfortunately its not
protected override void OnInit(EventArgs e)
{
rptDeptList.ItemDataBound += new RepeaterItemEventHandler(rptDeptList_ItemDataBound);
}
void rptDeptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
[Code]....
I have the following code
Response.TransmitFile(filePath);
Opens the new window using the following line of code
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Download", string.Format("window.open('{0}', target = 'new');", downloadURL), true);
This works on IE8 however doesn't work on IE6 and IE7