Michael,

I thought I'd run this by you too for some ideas.  The following code
doesn't use the AjaxPro.dll at all.
I can type in the value in one text box, then it'll go to the code
behind of another page and do the correct functionality....which will
tell the user if the number is distinct or not.
The only problem is when I post back the page, I get an IE error,
ieexplore.exe error, The instruction at "0x4a594476" referenced memory
at "0x00000004".  The memory could not be "read".

HTML code is:
<HTML>
        <HEAD>
                <title>WebForm1</title>
                <meta content="Microsoft Visual Studio .NET 7.1" 
name="GENERATOR">
                <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
                <meta content="JavaScript" name="vs_defaultClientScript">
                <meta content="http://schemas.microsoft.com/intellisense/ie5";
name="vs_targetSchema">
                <!-- Start script -->
                <script language="javascript">
var xmlHttp = createXmlHttpRequestObject();
function createXmlHttpRequestObject()
{
  var xmlHttp;
   if(window.ActiveXObject)
   {
      try
      {
         xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e)
      {
         xmlHttp = false;
      }
   }
   else
   {
      try
      {
         xmlHttp = new XMLHttpRequest();
      }
      catch (e)
      {
         xmlHttp = false;
      }
   }
   if (!xmlHttp)
        {
      alert("Error creating the XMLHttpRequest object.");
     }
   else
        {
   return xmlHttp;
   }
}
function process()
{
       varWBS =
encodeURIComponent(document.getElementById("TextBox1").value);
       xmlHttp.open("GET", "test.aspx?WBS=" + varWBS);
       xmlHttp.onreadystatechange = handleServerResponse;
       xmlHttp.send(null);
}
function handleServerResponse()
{
   //if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
   //{
   // document.getElementById("show").innerHTML = xmlHttp.responseText;

   //}
//}
//New code
        if (xmlHttp.readyState == 4)
        {   
                if(xmlHttp.status == 200)   
                        {
                        var parentElement = document.getElementById('show');
                        var wrappingDiv = document.createElement('div');
                        wrappingDiv.innerHTML = 
document.getElementById("TextBox1").value+'
'+xmlHttp.responseText;
                        parentElement.appendChild(wrappingDiv);

                        //document.getElementById("show").innerHTML = 
xmlHttp.responseText;
                        //document.all[show].innerHTML = xmlHttp.responseText;
                        }
                else
                {
                        alert("hmmmm");
                }
        }
}
//End code
                </script>
                <!-- End script -->
        </HEAD>
        <body MS_POSITIONING="GridLayout">
                <form id="Form1" method="post" runat="server">
                        <table id="maintbl" border="1" style="WIDTH: 952px; 
HEIGHT: 59px">
                                <tr>
                                        <td style="WIDTH: 327px"><asp:textbox 
id="TextBox1"
onblur="process()" style="Z-INDEX: 101" runat="server"
Width="100%"></asp:textbox></td>
                                        <td><asp:textbox id="TextBox2" 
style="Z-INDEX: 101"
runat="server"></asp:textbox></td>
                                </tr>
                                <tr>
                                        <td colspan="2">
                                                <div id="show" 
style="FONT-SIZE: smaller; COLOR: red"
runat="server"></div>
                                        </td>
                                </tr>
                                <tr>
                                        <td colspan="2">
                                                <asp:Button id="Button1" 
runat="server"
Text="Button"></asp:Button>
                                                <asp:Label id="Label1" 
runat="server">Label</asp:Label>
                                        </td>
                                </tr>
                        </table>
                </form>
        </body>
</HTML>


The code behind for the test.aspx page is:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        Try
            sCon1.Open()
            Dim strSQL As String = "Select count(*) from Table where
[Number] = '" &
Server.HtmlEncode(Request.QueryString("WBS")).ToString() & "'"
            Dim cmd As New SqlCommand(strSQL, sCon1)
            Dim intCnt As Integer = cmd.ExecuteScalar()
            sCon1.Close()
            If intCnt = 0 Then
                Response.Write("is unique, and able to be added!")
            Else
                Response.Write("is already used.  Please select another
Number!")
            End If

        Catch ex As Exception
            Response.Write(ex.ToString())
        Finally
            sCon1.Close()
        End Try


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to