|
Still don't get what it is you want to achieve.
You have two textboxes: one representing a name and the other represents age. You want to display the name and the age in a listbox - I assume this is not causing you any problems? You say you have a for-loop "to get multiple inputs". What do you mean by this? Perhaps you better post the code that doesn't work..
|
|
|
|
|
Drop the loop. Use a Button instead. Label it "Add". On a user's click on your AddButton, copy the current values of your input fields to the ListBox. Then clear the input fields and set focus on the first one.
That way, users can type in names and click on the AddButton as often as they want.
If you want to restrict the number of rows added to the ListBox, then you can implement that in your AddButton_Click method, too.
Ciao,
luker
|
|
|
|
|
... or use a grid view with two columns which will let you add and edit as many people as you like.
|
|
|
|
|
Do not double post - either post this in QA or the forums - not both.
Otherwise you duplicate work and annoy people.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
The way I see it you have 3 options: use the "Add" button sugestion, the gridview one, or make the user input a separating character between values, so you can take the inputs, split the strings by that character and work with the results.
I think the best one, for the average end user, would be the Add button, having more than 1 "value" in the textbox is not very efficient or comfortable.
|
|
|
|
|
Hi all, I am trying to change the name of each file as it's being downloaded. The following are what I have done thus far:
I have uploaded files to a folder on the web server but replace their names with GUIDs to prevent problems that could arise later on due to duplication . Their original names have been saved to a database and so are their extensions and the paths to their new location on the web server. The problem I am facing now is giving them their original names back when they are downloaded.
I know I have to replace the GUID with their original names and original extension when they are being downloaded. I have looked at using Response.AddHeader() method but I am not quite sure on how to make it work. Suppose a file in a folder on the web server have the GUID 123-GtR-XYZ as its name and suppose its original name was test.doc. How do I replace the GUID with the file's original name while it is being downloaded? The following is the method I currently use to retrieve a file from the folder on the web server.
DataTable Dtable = new DataTable("INFO");
Dtable.Columns.Add("URL", typeof(string));
Dtable.Columns.Add("Files", typeof(string));
string[] fileEntries = Directory.GetFiles(Server.MapPath("~/Uploads/"));
foreach (string fileName in fileEntries)
{
Dtable.Rows.Add("~/Uploads/" + Path.GetFileName(fileName));
}
myGrid.DataSource = Dtable;
myGrid.DataBind();
Let's say that I have written a SQL query to retrieve the original file name and original extension of the file being downloaded and now we have the GUID, the original file name, and original extension. How do I make use of those data to give each downloaded file it's original name back? Please give a code snippet or point me to a good tutorial if you can. Thank you in advance for your help.
modified 14-Sep-12 1:12am.
|
|
|
|
|
Response.ContentType = this.FileContentType;
Response.AddHeader("Content-Disposition", "attachment; filename=" + this.FileName);
If the filename has a space in it then either the whole filename should be quoted (and quotes in the string escaped). Or the entire filename should be encoded, which will use %20 to represent a space.
|
|
|
|
|
Hi s_magus, thanks for replying. How do I make use of the two lines you've posted in my existing code? Thanks again for replying.
|
|
|
|
|
What, exactly, do you have against using the ASP.NET forum, which is where your posts belong?
|
|
|
|
|
Nothing, since my question had to do with c# I just thought it was ok to post here.
|
|
|
|
|
It doesn't matter what the language is, the problem is an ASP.NET one. So far, all your questions should have been asked there.
|
|
|
|
|
I have previous experience using WinForms and the DataGridView control. I am trying to re-code a previous program using WPF that reads a parts list from a delimited text file and displays results in a DataGrid control.
In WinForms, I was able to assign a tag to the DataGrid row that I used to link individual URLs to our company's HTML-based inventory program. However, I am unsure how to do this (if it's even possible) in WPF. Currently, I read from the text file and load its contents into a List. From there, I filter the List by whatever the user selects, then display the results in a DataGrid control. I want to open up the browser when the user selects a row, but can't figure out how to bind the URL to the row. Is this possible? If so, can someone help point me in the right direction?
Thanks.
|
|
|
|
|
Just realized this probably isn't the best place to post this question and re-posted in Silverlight/WPF forum. Sorry.
|
|
|
|
|
I have a C# 2010 console application calling a second console application. I want the main calling console application to wait for the e_Process1 console application to quit running before the second console application is called with different parameter.
I want the main calling console application to look at values in a sql server 2008 database before calling the second console application with different parameters.
When you look at the 2 lines of code listed below, you will see that the main console program is watiting for the second console application to run. However the main console application is stilling waiting.
Code referecing to:
e_Process1.Start();
e_Process1.WaitForExit();
Thus can you tell me what you suggest I do to solve my problem? Either the second console application never quits executing and/or I need to use diferent statements.
Thus can you tell me what you suggest I do to solve my problem?
|
|
|
|
|
Sounds like the first application is doing exactly what you want it to do. You should be investigating why the second application never exits.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
I have to agree with Wes. What is the problem? It is doing exactly what you are telling it to do. Do you want it to wait or not? Do you want to add a timeout to the process?
|
|
|
|
|
I probably should add a timeout to the process. How do you do that?
|
|
|
|
|
Before you do something like this, do you know why it's hanging?
|
|
|
|
|
I do not know why the application is hanging.
Maybe the "second console" application never stops running? Is there a way that I can tell if the "second console" application ever stops running? If so, how can I tell when the "second console" application has finished executing?
Basically the second console application calls a web service to obtain information. The "second" console application has a proxy in it to communicate with the web service.
There is an 'xsd' file that communicates with the web services via xml. Do proxies always keep running?
|
|
|
|
|
You can check if the process exists, that's one way.
|
|
|
|
|
You should forget about using Process.Start for the moment and make sure that you understand how the second application behaves when run manually in a command window.
Hopefully after typing in the correct command line, the application will run and then exit. If the running application requires user interaction, e.g. "Press a key to exit", then it may be a poor candidate for automation via Process.Start.
If the manual run is ok can you post the code used to initialise the Process object.
Alan.
|
|
|
|
|
I am going to run the application manually and let you know what I find out.
When I run the application from the console application, here is the code to get the application running:
private static String strConsoleAppLocation = "C:\\temp\\Eclient.exe";
private static String strEncryptedValue = "encrypt value"
private static String strWebServiceurl = "https://test1/testWebService";
Process_Arguments = null;
Process eProcess1 = new Process();
eProcess1.StartInfo.FileName = strConsoleAppLocation;
Process_Arguments = strEncryptedValue + " " + strWebServiceurl + " 10 " + SPkgID;
eProcess1.StartInfo.Arguments = Process_Arguments;
eProcess1.Start();
|
|
|
|
|
I want to make the following comments:
1. When I stepped through the code using a visual studio.net 2008 debugger, the application did finish executing when the main procedure finished executing. Basically there was no where for me to step through the code again.
However the debugger was still active and ready to continue debugging.
Does this the application is still executing?
2. As far as I can tell, the application runs fine from the dos window. It does not ask me to enter any information. Does that mean it has finished executing?
|
|
|
|
|
Some apps may be behave differently when run "normally" or from a batch or with pipes and redirection.
You might want to try running it via my ProcessCommunicator[^] to see how it actually behaves when executed in a Process.
|
|
|
|
|
I would like to call psexec or a native class inside of a simple GUI, so that I can query racadm.exe (a dell utility) on a remote server and get current drac information for that particular box.
Is there a wrapper available for this?
Thanks!
|
|
|
|