|
This is not clear. Can you explain what you are trying to do?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Passed by value to iframe
|
|
|
|
|
FrameParent.aspx
<form id="form1" runat="server">
<asp:Label id="Label1" runat="server" Text="FrameParent.aspx Label1.Text"></asp:Label>
<iframe id="IFrame1" src="TestFrame1.aspx" frameborder="1" scrolling="AUTO" title="TestFrame1" />
<iframe id="IFrame2" src="TestFrame2.aspx" frameborder="1" scrolling="AUTO" title="TestFrame2" />
</form>
TestFrame1.aspx
<form id="form1" runat="server">
<div>
<asp:Label id="Label1" runat="server" Text="TestFrame1.aspx Label1.Text"></asp:Label>
<input type="button" onclick="onShowParentButtonClick();" value="Show Parent" />
<input type="button" onclick="onShowFrame2ButtonClick();" value="Show Frame2" />
</div>
</form>
<script type="text/javascript">
</script>
<script type="text/javascript">
</script>
TestFrame2.aspx
<form id="form1" runat="server">
<div>
<asp:Label id="Label1" runat="server" Text="TestFrame2.aspx Label1.Text"></asp:Label>
</div>
</form>
|
|
|
|
|
i am trying to create a shopping cart, on productdetails page i displaying productid, ProductName, productImage, ProductPrice and Buy Now Button. i have also created a movable shopping cart by using javascript. Now my problem is i am not able to pick the selected items id and send it javascript function for shopping cart. please guide me how to pick the id of the selected item and send it to the javascript function.
Thanks in Advance
|
|
|
|
|
I don't understand your question?
pick up the productID, pick it up from where?
The buy now button?
[edit]
you can try a hidden textbox, use javascript to place the part number in it, and then read the textbox
modified 23-May-13 17:25pm.
|
|
|
|
|
use this format onClinentClick="Script_Name(this.id);"
function Script_Name(id)
{
var oID = document.getElementByID(id).value;
alert(oID);
}
modified 29-May-13 2:15am.
|
|
|
|
|
Hi guys,I'm mohamed hussain working as dotnet developer.can anyone point out what are all the technical difference between telerik and devExpress control ?????
|
|
|
|
|
You need to go and do some research into the subjects; it's unlikely that anyone is going to be able to answer such a question.
Use the best guess
|
|
|
|
|
i already tried a lot.but still it's complicated to find out
|
|
|
|
|
Well it's complicated for everybody; but that's what being a developer is all about.
Use the best guess
|
|
|
|
|
Yes You are Correct ... I'll find out and post the answer
|
|
|
|
|
Could not up-vote that enough times
|
|
|
|
|
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
....
|
|
|
|