|
Why on earth do you need to use your webservice from your site ? That's just pointless. I think what you may want to use is AJAX, but that's different.
You should probably explain what it is you're trying to achieve. It sounds to me like you need to read a basic book and find out what these things are for, but I could be wrong.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Ha ha ... You are right.
|
|
|
|
|
I have right click on my website in visual studio->add newitem->WebService.asmx
i write a simple translator in Service.cs
but I can't use this service in my website?
|
|
|
|
|
You didn't read my post. You CAN add a webservice, and you can probably use it, it's just a STUPID thing to do. So, the question is, WHY do you want to do this ? What do you think it will help you do ? Once you answer me that, then I can tell you how to do what you want.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I just want to learn that how can I use a websevice.asmx in my website.
|
|
|
|
|
Is your webservice is hosted in another server than your website???
If not then I think it is always better to do the task directly. Web Servers spawns a new thread to every Request made. Thus, if you are calling a web service to get Response, your Web Server will create a new thread and make a request, means an added load to the server to the request.
This way you are actually using Two threads when this could be done in a single one.
Hope you understand our concern.
|
|
|
|
|
I just want to learn thay how can I use a websevice.asmx in my website.
I right click on my website and Addwebrefrence and i browse to "Web services in this solution "
and find in URL column "service.asmx".I write "service.asmx" in URL (in address bar )but didn't accept?
what shoud i do?
I have two textbox in one of my page and user shoud fill one of them and press button.
now on cick_button Event i shoud get this text and use my webservice(my webservice is translator)to translate this word.
I should send textbox1.text to my webservice and webservice return a string that i should put it in textbox2.text;
|
|
|
|
|
The problem is that it is idiotic to use a webservice hosted on the same server. If you want to learn how to use webservices, find an external one that you can connect to. I suspect your issue is that your webservice is not running, because when you add a reference, your site is not running.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
i didn't undrestand that you said "find an external one that you can connect to"?
and what should i do for the next problem that you said?"I suspect your issue is that your webservice is not running, because when you add a reference, your site is not running"
|
|
|
|
|
I think you need to go back to reading a very basic book. I'm sorry, I can't explain it much simpler than that.
Webservices exist to provide an interface to an external client. There's plenty you can find and connect to from your site. As your website has access to your code already, there is no use in writing a webservice that connects to the same site. A webservice is not running if it's not on a live server. Your server only runs when you debug the site. So it does not exist when you try to connect to it.
You've got everything wrong and everything backwards. Start simpler. Read more. Try to understand what it is you are doing.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
farokhian wrote: I just want to learn thay how can I use a websevice.asmx in my website.
Here you go
using web service in asp.net[^]
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
why dont you use :
http://msdn.microsoft.com/en-us/library/8wbhsy70(VS.80).aspx[^]
You will find step by step tutorial here.
farokhian wrote: I right click on my website and Addwebrefrence and i browse to "Web services in this solution "
and find in URL column "service.asmx".I write "service.asmx" in URL (in address bar )but didn't accept?
You need to mention WebReference Name.. which you later use as your main Class for calling the web methods.
|
|
|
|
|
|
I need to implement the following:
I have datatable, from which a dataset is created by selecting all rows. after sorting the dataset based on one column, then I want to get first 5 rows and create a new dataset with the top 5 rows, how to do?
I have tried several methods, not successful.
thanks for any hint.
|
|
|
|
|
First of all, let me clear your concept about DataSet, DataTable and DataRow.
1. DataSet ( It is a collection of DataTables)
2. DataTable (It is a collection of DataRow)
3. DataRow (It is a collection of Data Elements)
Well, Now if you have a datatable, you cant create a DataSet from it... as basically it is already a part of a dataset. If you are talking about coping some rows from one DataTable to a new DataTable, this can be done. Just I am going to create an example for you below :
DataTable dtNew = dt.Clone();
var dataSelect = (from r in dt.AsEnumerable()
orderby r[0]
select r).Take(5);
foreach (DataRow dr in dataSelect)
{
DataRow newRow = dtNew.NewRow();
for(int i=0; i<dr.Table.Columns.Count; i++)
newRow[dr.Table.Columns[i] = dr.Table.Columns[i];
}
After the foreach loop the DAtaTable dtNew will hold only the 5 elements selected in dataSelect.
Hope you got the point. Just mold this into your requirement.
Cheers
|
|
|
|
|
thanks, but .take can be used for ADO.net?
|
|
|
|
|
yes.. Actually Take comes as Extension Function to all Enumerable objects. You can use them easily.
Only thing is to add System.Linq namespace to your project. The Static class Enumerable defines all those Extension Methods to IEnumerable objects.
Cheers..
|
|
|
|
|
Hello
I want to put some downloadable files on my website. Should I use hyperlink on my pages or there is a better way?
Thanks a lot
|
|
|
|
|
If you have the physical files on the server than a hyperlink is the quick and best solution.
Another option is to store/upload the files in database and than stream them to the client.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Well... If the folder that contains the files is within your virtual directory path then you can use it directly.
But remember, This means you are going to open the link for everyone.. Anyone who doesnt have login even can download the file.
Rather than doing so, I like to have files in a secured folder (Say D:\secret) where my website is running in another path(say C:\MyWebSite), or rather files are in another file server which is within the same network say (\\server2\files)
Now when the user clicks on a link, the Onclick Event handler will transmit the file to the client using
Response.TransmitFile() .
|
|
|
|
|
I have an .ascx which contains a listview. Let's call it the parent.
Within its ItemTemplate I reference a second .ascx which is basically another listview, let's call it the child. On the parent, the child control is wrapped in a placeholder tag. I use this place holder tag to show and hide the child.
Psuedo code:
<asp:Placeholder id="plhChild" runat="server" visible="false" >
<uc0:childList id="childListCtl" runat="server" />
</asp:Placeholder>
The child listview has a 'close' button in its Layout Template. Let's call it "btnClose" with an onClick event of "btnClose_Click". I want to use this button to set the visibility of the containing placeholder.
I'm trying to avoid doing something like using
PlaceHolder plhChild = (PlaceHolder)childListCtl.NamingContainer since I can't guarantee every instance of the child .ascx will be contained within a placeholder.
I tried creating an event in the child that could be subscribed to.
Psuedo code:
public delegate CloseButtonHandler();
public event CloseButtonHandler CloseButtonEvent;
And in the actual btnClose_Click(Object sender, EventArgs e) event I have:
if (CloseButtonEvent != null) CloseButtonEvent();
My problem is that the delegate CloseButtonEvent is always null.
I've tried assigning the delegate in the listview's OnDatabound event of the parent and on the click event that set's the plhChild.visible = true, and I've stepped through the code and know the delegate instantiation works in both place, but again, when it gets to the btnClose_Click event on the child, the delegate is null.
Any help would be appreciated.
Neil
|
|
|
|
|
Basically the Placeholder once rendered to the client is just a DIV. So why dont you create btnClose a server side one and just use javascript to change the visibility of the placeholder.
This will eliminate the unnecessary postback of your page. Just in the DataBound event use
btnClose.Attributes.Add("onclick","javascript:yourfunction('" + placeholderId + '");
On your case, as it is a custom delegate defined by you, ASP.NET will not add its handler. Delegates only get object when a function is assigned to it. Use
this.yourclass.CloseButtonEvent += new CloseButtonHandler( put method name here that will handle the event );
Write this in Page_Load.. and as Page_Load is always called first before the actual btnclick event is triggered, the delegate will have the function.
|
|
|
|
|
Hi,
I've successfully loaded an XML file into a TreeView by using the XmlDataSource , which appears to be quite convenient. I can then add and remove items on the TreeView but having called the XmlDataSource.Save() method, my changes are not persisted to the file so when I bind the TreeView back to the XmlDataSource , I lose my changes.
1. I click the "Load" button which initiates the TreeView contents from the XML file by simply calling DataBind() on the TreeView.
2. I then add/edit/delete nodes using suitable buttons and my changes are reflected in the TreeView - that works fine.
3. I click the "Save" button.
I'd expect the XmlDataSource.Save() method to write my TreeView back to the bound data source. I've tried calling BindData() on the XmlDataSource itself but that does nothing.
Any suggestions please?
|
|
|
|
|
bugmenot1234 wrote: I'd expect the XmlDataSource.Save() method to write my TreeView back to the bound data source.
I would ask you to check that if you are getting any exception while performing Save.
I was going through the MSDN [^]documentation of Save method, I found few points which you should consider as it can be used only for following scenarios -
1. The XML data is loaded from an XML file indicated by the DataFile property, not from inline XML data specified in the Data property.
2. No XSLT transformation is specified in the Transform or TransformFile properties.
Also, keep in mind Save does not handle concurrent scenario.
|
|
|
|
|
hi
How can i have the HTML output of the specific .NET control in a page
|
|
|
|