|
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
|
|
|
|
|
behnam_behnam wrote: How can i have the HTML output of the specific .NET control in a page
You need to elobrate your question.
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.
|
|
|
|
|
use
RenderControl(writer) ... where writer is HtmlTextWriter
After the execution of the line writer will hold the html.
|
|
|
|
|
can you explain me by code
|
|
|
|
|
It a function associated with Every control. You can get the Response that the server control will generate from this function.
Check this
MSDN[^]
|
|
|
|
|
Hi,
I have a table 'Tbl1' with 3fields: NidTbl1, NidTbl2,number.
NidTbl1 is primary key and NidTbl2 is a foreign key.
Now how can I get the NidTbl1 which all number fields are greater than 0
Best wishes
|
|
|
|
|
mehrdadc48 wrote: Hi,
I have a table 'Tbl1' with 3fields: NidTbl1, NidTbl2,number.
NidTbl1 is primary key and NidTbl2 is a foreign key.
Now how can I get the NidTbl1 which all number fields are greater than 0
First of all this Question has nothing to do with ASP.NET.
mehrdadc48 wrote: Now how can I get the NidTbl1 which all number fields are greater than 0
Select NidTbl1 from Tbl1 where number >0
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Sorry I went wrong.
I want the NidTbl2 s which ALL number fields are greater than 0
Best wishes
|
|
|
|
|
This is no way related to ASP.Net.
mehrdadc48 wrote: Now how can I get the NidTbl1 which all number fields are greater than 0
Select * From Tbl1 Where NidTbl1 > 0
I would rather suggest you to buy a book and start reading.
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.
|
|
|
|
|
Sorry I went wrong,
I meant the NidTbl2 s which all number fields are greater than zero
Best wishes
|
|
|
|
|
You seriously think of buying a book.
mehrdadc48 wrote: Sorry I went wrong,
I meant the NidTbl2 s which all number fields are greater than zero
The only change would be thn:
SELECT * from TBL1 WHERE NidTbl2 > 0
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.
|
|
|
|