Click here to Skip to main content
15,898,035 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionMichel-jhone's question's answer Pin
afsal qureshi14-Jul-08 4:43
afsal qureshi14-Jul-08 4:43 
Questionjavascript alert ok button click to proceed further in asp.net --- urgent Pin
dream_liner_7e714-Jul-08 4:35
dream_liner_7e714-Jul-08 4:35 
AnswerRe: javascript alert ok button click to proceed further in asp.net --- urgent Pin
windhopper14-Jul-08 4:40
windhopper14-Jul-08 4:40 
QuestionRe: javascript alert ok button click to proceed further in asp.net --- urgent Pin
Sherin Iranimose14-Jul-08 5:16
Sherin Iranimose14-Jul-08 5:16 
QuestionRe: javascript alert ok button click to proceed further in asp.net --- urgent Pin
dream_liner_7e714-Jul-08 5:32
dream_liner_7e714-Jul-08 5:32 
AnswerRe: javascript alert ok button click to proceed further in asp.net --- urgent Pin
leoinfo14-Jul-08 5:54
leoinfo14-Jul-08 5:54 
GeneralTHANK YOU TOOOOOOOOOOOOO VERY MUCH THANKS ALOTTTTTTT, CODE WORKED PERFECTLY Pin
dream_liner_7e714-Jul-08 10:43
dream_liner_7e714-Jul-08 10:43 
Questionasp.net with jquery Pin
highjo14-Jul-08 3:13
highjo14-Jul-08 3:13 
Hi! guys i'm using jquery to do some interesting interaction in a sms sending web application.from a textbox where the user should write the phone number(numbers are comma separated) after writing a comma the application extract that number and send it through jquery ajax function for number validity.so far everything is cool even though i know that my function extracting is not perfect(coz it becomes buggy when the first comma is pressed and then the number is edited if somebody fell to give better algorithm i would be pleased).the problem arises when collecting the response from the webform.the response which a boolean is actually sent with this Response.write(response).when i display it from an alert function is dispay something like
true //if it's correct or false if not and something like this


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1">
    <div>
    </div>
    </form>
</body>
</html>

how do i extract actually the value true or false. my code is not seeing the true but always execute the statment in case it's false even though i have it true and displayed as described in my checkout alert function
here are my codes.
this is the one using the jquery
<br />
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"  EnableViewState="true" %>]]><br />
<br />
<![CDATA[<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"<br />
    Namespace="System.Web.UI" TagPrefix="asp" %>]]><br />
<br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head runat="server"><br />
    <link rel="Stylesheet" type="text/css" href="styles/txtBuddy.css" /><br />
    <title>Untitled Page</title><br />
    <script type="text/javascript" language="javascript" src="library/jquery-1.2.6.js"></script><br />
<br />
    <style type="text/css"><br />
#vall { color: #0000FF; width:30px;float:left;margin-left: 10px} <br />
#err { color: #FF0000; width:30px;float:left;margin-left: 10px}<br />
</style><br />
</head><br />
<body><br />
    <form id="form1" runat="server"><br />
        <script type="text/javascript" language="javascript"><br />
$().ready(function(){<br />
	    var i = -1;<br />
      $('#txtNumbers').keyup(function(e){    	<br />
	    var key =  e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;<br />
	    if(key== 188)<br />
        {<br />
  	        var y = $(this).val();  	        <br />
	        if(y.length!= 0 )<br />
            { <br />
		            var n = y.substring(i+1,y.lastIndexOf(','));<br />
		            i = y.lastIndexOf(",");<br />
		            alert("index   " + i + " and value  " + n);<br />
		            if(n != " " && n.length > 1)<br />
		            {<br />
                        $.ajax({<br />
			                    type:"POST",<br />
			                    url:"DestinationChecker.aspx",<br />
			                    data:"number="+n,<br />
			                    success:function(msg){<br />
				                    if(msg=="true")<br />
				                    {<br />
				                          alert("true");<br />
					                    alert(msg);<br />
					                   $('#valid').append("<div id="vall">"+n+"</div>");<br />
				                    }<br />
	                                else            			           <br />
				                    {<br />
				                        alert("false"); <br />
					                    alert(msg);<br />
					                    $('#valid').append("<div id="err">"+n+"</div>");<br />
				                    }<br />
					            }<br />
		                    });<br />
                        }<br />
                        else<br />
                        {<br />
                             alert("Please enter a number before the comma");<br />
                        }<br />
			}<br />
	    }<br />
    	<br />
    });    <br />
});<br />
        </script><br />
            <asp:panel id="container" runat="server" height="850px" style="z-index: 100; left: 25px;<br mode=" hold=" />                position: absolute; top: 38px" width="700px" bordercolor="Teal" borderstyle="Solid" xmlns:asp="#unknown"><br />
                BorderWidth="0.5pt" CssClass="grandcontainer"><br />
                <br />
                <asp:textbox id="txtNumbers" runat="server" style="left: 47px; position: absolute;<br mode=" hold=" />                    top: 284px; z-index: 103;"></asp:textbox><br />
               <br />
                <asp:button id="btnSend" runat="server" style="z-index: 109; left: 61px; position: absolute;<br mode=" hold=" />                    top: 793px" text="Send Message" onclick="btnSend_Click" /><br />
                <asp:button id="btnReset" runat="server" style="z-index: 110; left: 202px; position: absolute;<br mode=" hold=" />                    top: 793px" text="Reset" usesubmitbehavior="False" /><br />
                 <br />
                <asp:panel id="valid" runat="server" height="14px" style="z-index: 123; left: 273px;<br mode=" hold=" />                    position: absolute; top: 625px;float:left" width="348px"><br />
                     </asp:panel><br />
            </asp:panel><br />
    </form><br />
</body><br />
</html><br />

and the called page code behing file

<br />
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
using System.Text.RegularExpressions;<br />
<br />
public partial class DestinationChecker : System.Web.UI.Page<br />
{<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        string number = Request["number"];<br />
        number = number.Trim();<br />
        if(number.Length != 0)<br />
        {<br />
           bool res = this.checker(number);<br />
            Response.Write(res);<br />
        }<br />
    }<br />
    public bool checker(string testNumber)<br />
    {<br />
        Regex patterns = new Regex(@"^([1-9]{1}\d{8,15})$");<br />
        Match m = patterns.Match(testNumber);<br />
        return m.Success;<br />
    }<br />
}<br />
<br />

PS:sorry for the appearance my code was a bit long so i was oblige to cut out some unnecessary lines for this topic

eager to learn

AnswerRe: asp.net with jquery Pin
highjo14-Jul-08 9:20
highjo14-Jul-08 9:20 
Questionfind last week dates? Pin
Member 387988114-Jul-08 3:04
Member 387988114-Jul-08 3:04 
AnswerRe: find last week dates? Pin
Abhijit Jana14-Jul-08 3:29
professionalAbhijit Jana14-Jul-08 3:29 
AnswerRe: find last week dates? Pin
leoinfo14-Jul-08 3:58
leoinfo14-Jul-08 3:58 
QuestionLayers Pin
kenexcelon14-Jul-08 2:54
kenexcelon14-Jul-08 2:54 
AnswerRe: Layers Pin
Deepak the Cool14-Jul-08 3:12
Deepak the Cool14-Jul-08 3:12 
QuestionHow to Get Web User Control Value Pin
Deepak the Cool14-Jul-08 2:17
Deepak the Cool14-Jul-08 2:17 
QuestionResponse.TransmiFile Pin
kadkir14-Jul-08 1:49
kadkir14-Jul-08 1:49 
AnswerRe: Response.TransmiFile Pin
Sherin Iranimose14-Jul-08 2:26
Sherin Iranimose14-Jul-08 2:26 
GeneralRe: Response.TransmiFile Pin
kadkir14-Jul-08 17:25
kadkir14-Jul-08 17:25 
QuestionCall Unmanaged dll into VB.net Pin
Member 353051814-Jul-08 1:48
Member 353051814-Jul-08 1:48 
QuestionThe codefile attribute on the page directive is not allowed in this page Pin
Aavesh Agarwal14-Jul-08 0:59
Aavesh Agarwal14-Jul-08 0:59 
AnswerRe: The codefile attribute on the page directive is not allowed in this page Pin
Imran Khan Pathan14-Jul-08 1:45
Imran Khan Pathan14-Jul-08 1:45 
AnswerCross Post. Pin
Pete O'Hanlon14-Jul-08 2:22
mvePete O'Hanlon14-Jul-08 2:22 
Questionattach and sending emails automatically Pin
Member 387988114-Jul-08 0:49
Member 387988114-Jul-08 0:49 
AnswerRe: attach and sending emails automatically Pin
windhopper14-Jul-08 0:57
windhopper14-Jul-08 0:57 
QuestionHow to dynamically add value to table header cells Pin
Rameez Raja14-Jul-08 0:37
Rameez Raja14-Jul-08 0:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.