|
You can use WebClient to do this task.
You should use the namespace- using System.Net;
then create an object for webclient -
webclient wc=new webclient();
CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri(ftpaddress), "Basic",new NetworkCredential(Username, password));
wc.Credentials = mycache;
wc.uploadFile(ftpaddress,filenametoupload) --this method can be used to upload the file you want..
Please go through the webClient section before going to do this.
|
|
|
|
|
Hi,
I am trying to catch exceptions in Application_Error in global.asax
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim err As System.Exception = Context.Server.GetLastError()
Response.Write(err)
End Sub
This err shows error 'File does not exist' on client.aspx page.I this page I have used user control,if I remove this user control error also removed.Why this is so......is there any suggestion.
Plz help........
Regards,
Nagraj
-- modified at 2:53 Saturday 18th November, 2006
|
|
|
|
|
i need to populate a gridview with two columns with a checkbox. so the user can select its desired rows, n when he/she presses the button all the checked checkbox values are collected somewhere. i/'ve done till populating the gridview, but i can' fetch the checked CheckBox values. it showing me false for even checked CheckBox. I have search the whol internet n im tired of searching please help me. Thanks
|
|
|
|
|
|
Hi All,
I 've created an application for super market management.. Its in ASP . NET and Code behind as VB .NET
In that for giveing alert message to rise purchase order, we have to find the average sales of the current month or year with previous bill numbers..
Can any one please help me to find how to find an average sales for particular month..
Thanks in advance
|
|
|
|
|
It really depends on how you saved the data in your database. Does it contain data on items sold and data such as date and bill number?
Although not very optimal you can write something like this:
SELECT AVG() AS AverageSalesPrice, FROM <br />
INNER JOIN ON ( = )<br />
WHERE BETWEEN AND <br />
GROUP BY
The lower bound is here the beginning of the month and the upper bound is the end of the month. Of course you need to provide the right fields to be able to calculate the average sales.
To be able to use this query in your website you need a modification to an existing page or a new page, that has the following code on the Page_Load method or behind a button:
using(SqlConnection conn = new SqlConnection(connectionString)) <br />
{<br />
conn.Open();<br />
using(SqlCommand cmd = conn.CreateCommand())<br />
{<br />
cmd.CommandText =
cmd.CommandType =
<br />
using(IDataReader reader = cmd.ExecuteReader()) <br />
{<br />
}<br />
}<br />
}
Hope this helps
WM.
What about weapons of mass-construction?
|
|
|
|
|
hello every Body,
i want know how to create reports in asp.net 2003.
thanx
rahul saini
|
|
|
|
|
fewsGewrtgrtgreastgeazesw
|
|
|
|
|
Very Nice quote.....
Regards,
Suresh Dayma
Everything Is Possible!
|
|
|
|
|
Hi All
I have one table mast_diagnosis in sqlserver.Code is primary key in table.
Values are stored in Code like 1,2,3.....in sequence.
But MY problem is that I want to insert one row between 2 and 3 from frontend.How can i do that?
is it possible?Pls reply me if u know ans.
Thanks
monika
|
|
|
|
|
what should be the number 2.5!
|
|
|
|
|
Create a Clustered Index on the field with DESC clause.
|
|
|
|
|
How do I specify that I want the data in a form to post to a DIFFERENT document?
I've come across the Button.PostBackUrl property, but it is available in ASP.NET v. 2.0 only, and I'm using v.1.1.
This seems like such a COMMON thing, I can't imagine that there isn't a SIMPLE way to do this....
Thanks,
Greg Stevens
|
|
|
|
|
Remove the runat="server" attribute from the first form and add Action attribute with the url of the second form.
There are no. of ways to achieve this however ASP.NET 2.0 method is quite simple.
You can always post back to the first form and use Server.Transfer to pass the control to the second form. The second form should be able to get the posted values from Request.Params
|
|
|
|
|
1) If I remove the runat="Server" attribute in the form, I can't use any of the server controls (asp:Button, asp:Label) or any of the server-side event handling INSIDE the form. I get a compiler error saying that in order to use server controls inside a form, the form element has to have the runat="Server" attribute.
2) I'm glad the ASP.NET 2.0 method is quite simple. That doesn't help me, though, because my server has ASP.NET 1.1.
3) I wouldn't want to use Server.Transfer because (to my understanding) that does not actually redirect the URL -- it loads the content of the target, but at the current URL location. But for various reasons, I actually want the location to be changed to the target document.
-> And, if I use Response.Redirect instead of Server.Transfer, then I don't think I can use the Request.Params directly any more.
Sorry to be such a pain, but I would still appreciate any help you might be able to give me.
-----G
|
|
|
|
|
1) If form runat="server" is removed then you can't have server side controls (Web & HTML server controls). Its going to be just plain old HTML controls
2) You can always post back to a form by posting back to a different form through code. I know its not simple however I thought I will share it with you.
On post back of the first form, retrieve the post back values and then post it back to another form.
String postedData = "field1=field1data&field2=field2dataOk";
StreamWriter out = null;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://yourURL/secondForm.aspx");
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postedData.Length;
request.Method = "POST";
out = new StreamWriter(request.GetRequestStream());
out.Write(postedData);
out.Close();
"field1=field1data&field2=field2dataOk" should be replaced with the actual list of form variables
3) Changing the action url using javascript on submit will be one of the option but you may have to do a lot that is unconventional.
|
|
|
|
|
#2 and #3 both make sense to me, and I will look into them as options.
Thank you very much for your help!
|
|
|
|
|
I have a form with one text field and one label and a submit button.
I have a regular expression validator on the text box field. Now i want
to clear the content of the label when i hit the submit button but the
regular expression validation on the text box is getting executed before
label clearing code.
My question is there a way to run some code to clear the label field before
validation on the form. I tried putting some code to clear the label in the
page load event but that doesn't seem to help.
Any help is greatly appreciated
|
|
|
|
|
Can you use javascript instead of validator control? if so you can change the value of the label before going to validate the textbox.
|
|
|
|
|
in the button event, do the following:
if (obj.AlphaValidate(txtValidate.Text))// checks for error.....
{
epObj.Dispose(); // if no error found, dispose Error Provider object
MessageBox.Show("No Error!");
}
else
{
txtValidate.Text = ""; // Clear text before showing off error
epObj.SetError(txtValidate, "Error");// Show error
}
|
|
|
|
|
Hi all
I have a customized data grid that shows and deletes employees
but I could not handle the GridView1_RowDeleting sub
Could u please help me...
nour_fa@yahoo.com
Nour
|
|
|
|
|
It would be helpful if you provide your code and where you are getting the error.
|
|
|
|
|
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
Try
'What is the code to put here
GridView1.DeleteRow(...what?)
GridView1.DataBind()
Catch
Response.Write(Err.GetException)
End Try
end sub
Thanx dear
|
|
|
|
|
I develop a website and i want to integrate a chat room and a forum facility.So plz send me so soon the full source code for both.
Cheers!
Thanks guys.
|
|
|
|
|
You searched very hard through CodeProject did ya?
|
|
|
|