|
Thank you, but once is more than enough.
Use the best guess
|
|
|
|
|
There are lots of controls. Can you be more specific as to what you are looking for?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
actually i need the difference between telerik(radcontrols) and devexpress(aspx) ..can u point out any difference ???
|
|
|
|
|
Telerik [^]makes many different controls and DevExpress [^]is a collection of controls also. Have you been to their websites?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have no idea what I am wrong. Needless to say it is giving me a compiler error "Error 1 'clsWebServices' does not contain a definition for 'FindAddress' and no extension method 'FindAddress' accepting a first argument of type 'clsWebServices' could be found (are you missing a using directive or an assembly reference?)"
What do I need to do to make this Web Method / Web Reference work properly? This is for a local Access .mdb file that resides under app_Data.
This is what I have under App_Code for clsWebSerices.cs:
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Data.OleDb;
using System.Web.Services;
public class clsWebServices : System.Web.Services.WebService {
public clsWebServices () {
}
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public dsAddress FindAddress(string LastName, string Path)
{
string connectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path;
string commandText = "select * from tblAddressBook where LastName like '" + LastName + "'";
dsAddress DS = default(dsAddress);
using (var connection = new OleDbConnection(connectionString))
using (var command = new OleDbCommand(commandText, connection))
{
DS = new dsAddress();
var adapter = new OleDbDataAdapter(command);
adapter.Fill(DS);
}
return DS;
}
}
}
And for clsWebServices.asmx:
<%@ WebService Language="C#" CodeBehind="~/App_Code/clsWebServices.cs" Class="clsWebServices" %>
frmAddressBook.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="frmAddressBook.aspx.cs" Inherits="frmAddressBook" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" action="clsWebServices.asmx" method="post">
<div>
<asp:Label ID="Label1" runat="server" Text="Find Last Name: "></asp:Label>
<asp:TextBox ID="txtFindLastName" runat="server"></asp:TextBox>
<asp:Button ID="btnFindLastName" runat="server" Text="Search Now"
onclick="btnFindLastName_Click" />
<br />
<br />
<br />
<asp:Label
ID="lblMessage" runat="server"
Text="Search Result (first record to match)" Font-Size="XX-Large"></asp:Label>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="First Name: "></asp:Label>
<asp:TextBox ID="txtFirstName" runat="server" BackColor="#FFFFCC"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="Last Name: "></asp:Label>
<asp:TextBox ID="txtLastName" runat="server" BackColor="#FFFFCC"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="Email: "></asp:Label>
<asp:TextBox ID="txtEmail" runat="server" BackColor="#FFFFCC"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label5" runat="server" Text="Phone Number: "></asp:Label>
<asp:TextBox ID="txtPhoneNumber" runat="server" BackColor="#FFFFCC"></asp:TextBox>
</div>
</form>
</body>
</html>
The code behind:
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class frmAddressBook : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnFindLastName_Click(object sender, EventArgs e)
{
lblMessage.Text = "";
try
{
clsWebServices serviceObj = new clsWebServices();
dsAddress dsFindLastName = new dsAddress();
string TempPath = Server.MapPath("~/App_Data/AddressBook.mdb");
dsFindLastName = serviceObj.FindAddress(txtFindLastName.Text, TempPath);
if (dsFindLastName.tblAddressBook.Rows.Count > 0)
{
DataRow r = dsFindLastName.tblAddressBook.Rows[0];
txtFirstName.Text = r["FirstName"].ToString();
txtLastName.Text = r["LastName"].ToString();
txtEmail.Text = r["Email"].ToString();
txtPhoneNumber.Text = r["PhoneNumber"].ToString();
}
else lblMessage.Text = "No records found!";
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
}
}
}
I have tried to add a WEB REFERENCE in VS2008 and it says :
This web service is using http://tempuri.org/ as its default namespace.
Recommendation: Change the default namespace before the XML Web service is made public.
[WebService(Namespace="http://microsoft.com/webservices/")]
public class MyWebService {
}
|
|
|
|
|
The error message is quite clear, and also correct. The class clsWebServices doesn't contain a method called FindAddress . That method is defined on a nested class called Service1 .
Either move the method to the outer class, or change the class you're creating:
clsWebServices.Service1 serviceObj = new clsWebServices.Service1();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard thanks for the insight. I cleaned up things a bit to this:
clsWebServices.aspx.cs
using System.Data.OleDb;
using System.Data;
using System.Web.Services;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
[WebService(Namespace = "http://localhost:51557/Week3Lab/clsWebServices.asmx/FindAddress")]
public class clsWebServices : System.Web.Services.WebService {
public clsWebServices () {
}
[WebMethod(Description = "This method call will get the LastName and return the Dataset.", EnableSession = false)]
public dsAddress FindAddress(string LastName, string Path)
{
string connectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path;
string commandText = "select * from tblAddressBook where LastName like "+LastName ;
dsAddress DS = new dsAddress();
using (var connection = new OleDbConnection(connectionString))
using (var command = new OleDbCommand(commandText, connection))
{
var adapter = new OleDbDataAdapter(command);
adapter.Fill(DS.tblAddressBook);
}
return DS;
}
}
frmAddressBook.aspx.cs
protected void btnFindLastName_Click(object sender, EventArgs e)
{
lblMessage.Text = "";
lblMessage.Text = txtFindLastName.Text;
try
{
clsWebServices serviceObj = new clsWebServices();
dsAddress dsFindLastName = new dsAddress();
string TempPath = Server.MapPath("~/App_Data/AddressBook.mdb");
dsFindLastName = serviceObj.FindAddress(txtFindLastName.Text.ToString(), TempPath);
if (dsFindLastName.tblAddressBook.Rows.Count > 0)
{
DataRow r = dsFindLastName.tblAddressBook.Rows[0];
txtFirstName.Text = r["FirstName"].ToString();
txtLastName.Text = r["LastName"].ToString();
txtEmail.Text = r["Email"].ToString();
txtPhoneNumber.Text = r["PhoneNumber"].ToString();
}
else lblMessage.Text = "No records found!";
}
catch (Exception ex)
{
lblMessage.Text = lblMessage.Text + ex.Message;
}
}
When I submit the FORM it has this in the submit :
<form id="form1" runat="server" action="clsWebServices.asmx/FindAddress" method="post">
I am getting this though as an error:
System.InvalidOperationException: Missing parameter: LastName. at System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection) at System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest request) at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
|
|
|
|
|
WickedFooker wrote: When I submit the FORM it has this in the submit:
<form id="form1" runat="server" action="clsWebServices.asmx/FindAddress" method="post">
Why? If you want to call the service from the code-behind, you need to post back to the same page. Your form is trying to post directly to the service instead.
I haven't tried it, but posting to the service might work if you use client-side controls so that the names match the parameter names precisely. You can't use the server controls, because ASP.NET will mangle the names to make them unique. However, even if it works, the result isn't going to be something you want to display to the user.
If you want to call the service from the browser without posting back, you'll need to use javascript:
http://msdn.microsoft.com/en-us/library/bb398995%28v=vs.90%29.aspx[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Okay. I got it working 100%. I was totally over-thinking things. I made some minor changes to part of the code and took out the form submit junk I had. Thanks again for your help.
|
|
|
|
|
you can share for me source code form comment ?
I want to create form comment with avatar(of user) and it can edit, delete, and save to database.
thanks !!
|
|
|
|
|
|
|
what is the best way to store string list (80 items)?
it looks like this:
1 One
2 Two
3 Three
....
|
|
|
|
|
Store for what use? in db? in memory? in file? What are you doing with it?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
To me the best way to store a list of strings a List<String> .
Simples really!
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
use String builder . it's best one store to string and then compare to string is very fast..
Another one
- List<string> slist = new List<string>();
|
|
|
|
|
I have a view for import batches (headers, not details), which a link to start a new import. When the user clicks that link, I want to invoke my Import action method. Inside that standard, synchronous action method, I want to start an asynchronous task, and then redirect back to another view. That view will monitor the progress of the async task with ajax calls and update the view so the user can follow the progress.
Everything I can find goes into too much complexity with async action methods etc. which is overkill for me in the prototyping phase.
Suggestions and critique of what I want to do will be most welcome.
|
|
|
|
|
anyone plz tell me which is free version of iTextSharp library for pdf file exporting?
|
|
|
|
|
|
Comparison of MVC & n-Tier Architecture
Give comparison regarding their
->Advantages
->Disadvantages
->Purpose of use
etc etc
|
|
|
|
|
|
|
hi experts,
i am trying to install vsn server 2.5.9 from the link http://www.visualsvn.com/visualsvn/download/[^]
while installing vsn server i was asked to choose port no(2 port nos are displayed 443 & 8443).i have chosen 443 port no for https.so what i did is i removed https & selected 443 for visual vsn.now vsn is working fine.the issue i am facing is i am unable to run my application on iis using http.when i run my application i am getting "the address is incorrect,type the correct address".but the address is correct in the address bar.how to overcome this problem?if i want to run my application using https what port n do i have to choose?could anyone help me pls...
|
|
|
|
|
Okay so very easy to validate an email in ASP and also very easy to validate that someone enters between 6 and 30 characters but can someone help me in making sure that BOTH are checked in a Custom Validation perhaps. What I have for example:
<asp:CustomValidator ID="CustomValidator1" ClientValidationFunction="/^([_a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,3})$/" runat="server"
ControlToValidate="txtUserName" ErrorMessage="CustomValidator"
SetFocusOnError="True"></asp:CustomValidator>
I am sure it is something simple but just need to know. Right now all it is doing is just checking that the email is valid, but if nothing is on the field it checks nothing.
|
|
|
|
|