|
What does this have to do with ASP.NET ?
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 found this example from msdn:
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://192.168.0.9/");
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential("anonymous", "janeDoe@contoso.com");
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
Console.WriteLine(reader.ReadToEnd());
Console.WriteLine("Directory List Complete, status {0}", response.StatusDescription);
reader.Close();
response.Close();
when i write it in consoleApplication it is right, but now i want write it in webApplication and show the output in tree can u help me?
|
|
|
|
|
OK, so your question now is, how do you show the result of this call in a tree ? You will need to parse reader.ReadToEnd(), and then you will need to take that data and put it into your tree structure.
Why would you write a website which supports FTP like this ? You're going to let users move data to and from your server ?
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.
|
|
|
|
|
WebRequestMethods.Ftp might help you out. See this[^] stricle here at CP.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
i m using MultiView and view controls on single asp.net2.0 page. i have place my image buttons inside the view controls which are upto 130 buttons. when i place some more image buttons it show this error in he Exception of type " System.OutOfMemoryException" was thrown. i don't know whats problem. please help me to handle this problem
thanks
|
|
|
|
|
Saif-ur-Rehman Tanoli wrote: type " System.OutOfMemoryException" was thrown
Its very difficult to tell the details of the error with out much knowing about your application. The cause is Memory.
Where is your application hosted?
Which session mode are you using?
Is there any larger data in Session?
Are you tried to downloading larger number of image?
Please Read This Article for More Information[^]
|
|
|
|
|
thanks for reply.
actually i m using view control to show separate page.
for example
when home button clicked
void btn_home_clicked( )
{
MultiView1.SetActiveView(Home);
}
i have added all features required by homepage in home view control and similarly all other pages are filled in this way. now as i m handling all pages(home,jobs,sale,etc) in a singe Multiview control. suppose i want to add some more control on jobs view when i drag and drop control there it will add an error tag there. with message
Exception Type "Ssytem.OutOfMemory" Exception was thrown.
i hope now you understand problem
|
|
|
|
|
System.OutOfMemoryException occurs when server side memory is exhausted. See if there is some recursive calls available... which runs infinitely. Remove if you find one..
Other than that, you need to use your resources properly while creating response.
|
|
|
|
|
Hi guys,
I want to display the selected item in a dropdownlist when I select it !!!
there's only one available, but i doesn't seem to work !!!
I use :
DDL.SelectedItem.Value.ToString()
I think I should use postback here but dunno how !
|
|
|
|
|
Enable AutoPostback For DropDown List
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>a</asp:ListItem>
<asp:ListItem>b</asp:ListItem>
<asp:ListItem>c</asp:ListItem>
</asp:DropDownList>
|
|
|
|
|
As far as I know Using session for so many variables makes the web-page performance lower. However I am not sure what to use instead of it. There are some important information that I do not want to pass thru querystring such as UserID etc.
Do you have a better idea?
|
|
|
|
|
Session should be fine for storing something like a UserID, it shouldn't cause significant degradation in performance. However, if you are also using Session state to store things like DataTables or other large amounts of information, I'd rethink the design.
only two letters away from being an asset
|
|
|
|
|
I am completely agree with Mark, Use of session depends of what kind of data you want to store. UserID or some UserInformation. But try to avoid store large amount of data inside data.
Here is one of my article on Session, which may help you
Exploring Session in ASP.NET
|
|
|
|
|
Session are very good when used corretly not abused and as the other guys said, you can use it to store UserID or other type of data that you want to use across pages. well i have seen Sessions being abused , when someone try to store a dataset in a session variable. in that case you will come across a problem with peromance.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hello I am trying to return a value thru viewstate. However the code below gives nullreference problem. Can not Viewstate be used at pre_init event?
protected void Page_PreInit(object sender, EventArgs e)
{
if (!IsPostBack)
{
con = u.getconnection();
con.Open();
cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_UserMenuCount";
prmUserID = u.prm("@UserID", ParameterDirection.Input, SqlDbType.BigInt, 8, "1"/* Session["UserID"].ToString()*/); con = new SqlConnection();
prmCount = u.prm("@Count", ParameterDirection.Output, SqlDbType.Int, 8, "farketmez"/* Session["UserID"].ToString()*/); con = new SqlConnection();
cmd.Parameters.Add(prmUserID);
cmd.Parameters.Add(prmCount);
cmd.ExecuteNonQuery();
lb_Count = int.Parse(cmd.Parameters["@Count"].Value.ToString());
ViewState.Add("id", int.Parse(cmd.Parameters["@Count"].Value.ToString()));
}
else { lb_Count = int.Parse(ViewState["id"].ToString()); }
|
|
|
|
|
Ersan Ercek wrote: However the code below gives nullreference problem. Can not Viewstate be used at pre_init event?
Yes. This is Correct.
Because ViewState Data Load Just Before the Page_Load Event. So, if you are accessing ViewState in Pre_Init() it will not be initialize. Because LoadViewState() comes a later stage in ASP.NET Page life cycle .
|
|
|
|
|
How do I change active view when ScriptManagers OnNavigate event fires?
On button control click all is ok, however, when user clicks browsers back button fires OnNavigate.
It allows to change label.text property and it displays correct, but multiview shows old view
It`s nothing to wory before something happen and when it happents it`s alredy to late to wory!
|
|
|
|
|
Found what caused problem.
I forgot to add scriptmanager as triger to updatepanel, however, why there is no hint everywhere i`we looked about that.
It`s nothing to wory before something happen and when it happents it`s alredy to late to wory!
|
|
|
|
|
Dear All.
when i used the code below :
Dim con As New SqlConnection(connection string)
Dim cmd1 As New SqlCommand
Dim ds As New DataSet
Dim da As New SqlDataAdapter
Dim dt As New DataTable
con.Open()
cmd1.Connection = con
cmd1.CommandText = "SELECT Statment"
da.SelectCommand = cmd1
da.Fill(ds, "[Table Name]")
dt = ds.Tables("[Table Name]")
Label1.Text = dt(0)("Column Name")
con.close()
i got the error msg below :
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30367: Class 'System.Data.DataTable' cannot be indexed because it has no default property.
the error is here :Label1.Text = dt(0)("Column Name")
when i searched for the problem i found on MSDN site : the solution is to set the default property !! and i didn't understand what is that mean ?!
thank you advanced
best regards,,
|
|
|
|
|
Bannoota wrote: Compiler Error Message: BC30367: Class 'System.Data.DataTable' cannot be indexed because it has no default property.
The error message says it completely.
You are trying to select the first table from a table.
This line should be:
Label1.Text = dt.rows(0)("Column Name").ToString()
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.
|
|
|
|
|
Thank you all
Finally i found the solution:
instead of writing :Label1.Text = dt(0)("Column Name")
i wrote Label1.Text = dt.rows(0)("Column Name").tostring
and it works
Good Luck
|
|
|
|
|
Hello,
I have a gridview on my aspx page which is bounded to a SqlDataSource. SqlDataSource selects some rows from DB and gridview displays the results. Results are like;
Code / Point
------ / -----
FRA / 234
USA / 230
RUS / 228
GBR / 225
I want to add a new image column to gridview, and show the flags of countries on that column. I store the flag images on a folder, and flags are named like FRA.jpg, USA.jpg etc..
So i need to read the "Code" column and get the flag from folder with the text in "Code" column. As a result i will display all results from SqlDataSource plus one extra column which data of extra column will change according to the results.
Is this possible ?
Regards,
Ilker.
there are 10 types of people in the world, those who understand binary numbers and those who dont..
|
|
|
|
|
ilker_ege wrote: Is this possible ?
Yes, it is.
You need to modify/construct the table with one more column for the image.
Once you have the information from the database, loop through the all the rows and for each row read the image from the folder and add the image to the datatable.
I would also think of keeping the flag images in the database and get them as a result. This would prevent me to read the images from the folder.
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.
|
|
|
|
|
Thank you for your response. But instead of the ways you offered, i tried a different solution.
I added an ImageFied to my DataGridView and also i put the flags of countries in a folder under my website.
For the SqlDataSource Select Command, i added another parameter to select statement; like, "SELECT NATION_CODE, '~/images/Flags/'+ NATION_CODE +'.GIF' AS FLAG ... FROM ....... ". So the query returns the nation codes and the folder path for the images.
I select the ImageField and typed 'FLAG' for the DataImageUrlField property, so it follows the result of sql query.
By this way, i did not store the images as binary data on my tables. This was important for me, cos the data on the table was changing so frequently. Also i did not loop the gridview for the second time, so page loads quicker. My start point was finding nation code somewhere in codebehind, but the final solution seems much more better.
Anyway, thank you for your answer, that makes me think how i can use DB, so i got the solution..
there are 10 types of people in the world, those who understand binary numbers and those who dont..
|
|
|
|
|
hi,
I am using a griview inside an update panel.When the gridview renders it occupies the space of another division below it.It is making my layout slightly different from what i want.But when I don't use the update panel,my layout is ok.
regards
Bill
|
|
|
|