|
This is part 2 of wanting to send more than one parameter to Response.Redirect. I got a response on using the & operator, but since I'm using strings I kept getting errors. This is what I currently have:
Response.Redirect ("Add_Weight.aspx?IDOutput3=" + IDOutput3 + "strPartNumberInputReference=" + strPartNumberInputReference);
Which isn't right because it just smooshing everything together. Which make sense really how I'm looking at it, but I can't figure out the correct syntax. I swear I'm trying.
|
|
|
|
|
Try
Response.Redirect ("Add_Weight.aspx?IDOutput3=" + IDOutput3 + "&strPartNumberInputReference=" + strPartNumberInputReference);
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
|
I have a Winform app that I need to be able to send an email from with attachments. I don't want to use SMTP.Client for various reasons. I want to do the equivelant of mailto: someone@somewhere.com?subject=my subject&body=this is my message. I can do this using System.Diagnostic.Process.Start("mailto: someone@somewhere.com?subject=my subject&body=this is my message"); It is not pretty, but it works. I cannot assume Outlook is installed so I cannot use office automation.
The problem is I would like to attach a file to the email window that is opened when doing this. Winzip does this when choosing "Compress and email" from their context menu. I don't know if that option only shows up if you have outlook or if it works for other clients. If it works for other clients, that is what I am trying to do.
Anybody have any ideas on how they are doing this? Can it be done to work without knowing the email client installed?
Thanks.
|
|
|
|
|
Then you will have to list a very good reason. System.Net.Mail.SmtpClient seems aptly suited. You could use System.Net.TcpClient instead but it would be more tedious. BTW, mailto:, does not work according to your specs at it requires outlook to be installed and configured. (or another email client)
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
System.Net.Mail.SmtpClient would require my application to store UserID, Password, Server, Port, etc. to send an email using an SMTP server. Additionally, this would bypass their mail client and I would be responsible for keeping sent messages, etc. I was trying to avoid building an email client into my application and the complexities of configuring that for the end user. That is the very good reason.
I am trying to leverage the existing client and configuration that most likely already exists. mailto is working fine as described (as long as they have an email client installed). I am trying to figure out how to extend that functionality and attach a file to the opened email message window programmatically.
As mentioned, similar to Winzip "Compress and email". They may be using Outlook automation to do that. Anyone using Winzip something other than outlook or outlook express for an email client? If so, let me know if Winzip still provides that option and how it works.
Thanks.
|
|
|
|
|
May be available through a windows interface. You can most definately get the email settings from outlook. For Thunderbird, I dunno. One option with the mailto: would be sending the attachment in the body using UUEncoding however I imagine the console has a character limit.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
|
I am new to C# and have a class project to work on. I am trying to create an Amortization calulator the display the payment results based on the Time period thay have to repay the loan. The calculation part of it is working fine but I can not get it to display the result. Can I please get some help with this? See code Below:
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Label6.Text = "Final Balance: " +
CalculateBalance(Convert.ToInt32(TextBox1.Text),
(Convert.ToDouble(TextBox2.Text) / 100),
Convert.ToInt32(TextBox3.Text),
Convert.ToInt16(DropDownList1.SelectedItem.Value)).ToString();
}
private string CalculateBalance(int Principal, double Rate, int Years, int Period)
{
double result;
double NumToBeRaised = (1 + Rate / Period);
result=Principal * System.Math.Pow(NumToBeRaised, (Years * Period));
return (result.ToString("C"));
}
private string AmortDisplay(double Principal, double results, int Years, int Period)
{
int AmortTime;
double AmortPayment;
double RemBalance;
string Output;
AmortTime = (Years * Period);
AmortPayment = (results / AmortTime);
RemBalance = -(Principal - AmortPayment);
TextBox4.Text = "Duration\t \tPayment\t \tRemaining Balance \n" + AmortTime + "\t\t" + Convert.ToString(AmortPayment) + "\t\t" + Convert.ToString(RemBalance) + "\n";
}
protected void Button2_Click(object sender, EventArgs e)
{
AmortDisplay(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(Label6.Text),
Convert.ToInt32(TextBox3.Text),
Convert.ToInt16(DropDownList1.SelectedItem.Value)).ToString();
}
</script>
Greg
The Belizean Dan Dada!!!
|
|
|
|
|
Skanless wrote: Can I please get some help with this?
Someone might help you, especially if you post a question or problem instead of just saying "I can not get it to display the result."
:josh:
My WPF Blog[^]
|
|
|
|
|
this is a re-post. I would suggest that you read 'how to get an answer to your question' at the top of the forum. I am sure that someone could answer a question for you if you ventured to actually ask a question, provide some detail, etc...
cje
|
|
|
|
|
The code you posted will not compile. The function AmortDisplay, as written, does not return a value but is declared as returning a string.
In the calculation of Textbox4.text, AmortTime is not converted to a string.
This would be better done using String.Format anyway.
There is no error handling (try...catch) to capture conversion errors,
so any exception will just propagate up to the top and crash...
Why do you convert the result of CalculateBalance nto a string
(as the return value) and then immediatly convert it back
to a double in order to pass it to AmmortDisplay?
Clean up your code. avoid conversion operations in the parameters passed
to a function (do these as separate steps with local values,
pass the local values) - this:
AmortDisplay(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(Label6.Text),
Convert.ToInt32(TextBox3.Text),
Convert.ToInt16(DropDownList1.SelectedItem.Value)).ToString();
will be very hard to debug, and there are at least 5 opportunities
for a mistyped (or empty) entry field to cause an exception to be thrown
in that single function call.
Why the .ToString() at the end? the function called should have returned a string
(and would have, but you left out the return statement) anyway..
You definately need to study harder. This is really poor code, and would be unacceptable
in any production work.
Some advice:
1. Keep it simple, avoid complex function calls with nested calls
2. do things in clear descrete steps so you can inspect each easily.
3. don't change data types any earlier than necessary.
4. inspect your code with the presumption that there is a stupid error or oversight,
the best of us still make these occaisionally.
|
|
|
|
|
Why don't you follow up on the replies you get, instead of posting the question again?
---
b { font-weight: normal; }
|
|
|
|
|
Hello,
I have 2 treeView controls on my form. Can you please tell me how can I copy all the nodes with the same structure from treeView1 to treeView2?
Note: I'm using .NET 2005.
Your help would be greatly appreciated.
|
|
|
|
|
treeView2.Nodes.Clear();
foreach(TreeNode node in treeView1.Nodes){
treeView2.Nodes.Add(node);
}
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Thanks but I got:
Cannot add or insert the item 'Dogs & Cats' in more than one place. You must first remove it from its current location or clone it.
Parameter name: node
|
|
|
|
|
AngryC wrote: You must first remove it from its current location or clone it.
I'm gonna take a stab in the dark and suggest TreeNode.Clone() .
foreach (TreeNode tn in treeView1.Nodes) {
treeView2.Nodes.Add(tn.Clone() as TreeNode);
}
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
Hi, Does anybody know how to make a TextBox Array in a C#.NET Web Application?
And for CheckBoxes?
Oren,
|
|
|
|
|
TextBox[] tb = new TextBox[3];
CheckBox[] cb = new CheckBox[3];
:josh:
My WPF Blog[^]
|
|
|
|
|
Ok... I would have not think it was so simple, .
Thanks!
Oren,
|
|
|
|
|
hi i had get the color through color dialog box and saved them in database nd then i want to set on the form?
then i want to set the color of dalog reading from the datbase but it gives error that cannot change readonly property.
System.drawing.color clr=new color();
clr.A=a;//read from db; //gives error that cannot change readonly property
.R=b;
.B=v//et
now i want to set the form color to this.
this.color=clr;
how to assign values to color variables?
Tasleem Arif
|
|
|
|
|
Color is a struct and therefore mutable, supply values to it's static FromArgb method instead of trying to set properties after initialization.
Color c = Color.FromArgb(r, g, b);
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
as it is more suited to saving in a database.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
BoneSoft wrote: Color is a struct and therefore mutable,
You're correct in this case (if you prepend "im" to the word "mutable"), but structs in general are not necessarily immutable. Immutability of structs is a best practice, not a rule.
:josh:
My WPF Blog[^]
|
|
|
|
|
Woops! My intellisence ain't working today. Thanks for catching that.
And my understanding was that all structs are immutable, trying to change them just creates and swaps a new one behind the scenes, like strings or any other stacked value. So they seem to be mutable, though technically they are not. Maybe I have it wrong...
Try code model generation tools at BoneSoft.com.
|
|
|
|