Showing posts with label links. Show all posts
Showing posts with label links. Show all posts

Wednesday, March 28, 2012

Troubble with links in emails

I'm having trouble with links in emails which are sent from my webapp. I'm using System.Net.Mail.SmtpClient and sending mails as plain text. My email body contains a link e.g.http://www.blabla.com/Page.aspx. Some times the dot between blabla and com disappears when the recipient gets the mail.
I was sure this was an issue with the mail client, but apparently many of our customers are experiencing the same problem. I haven't been able to reproduce this problem myself because all my email clients display the links properly, but I have had some of our clients forward the mails to me, and the dot is actually missing. (http://www.blablacom/Page.aspx).
Have any of you guys seen this problem before? And how can I solve it?Are you still using the Beta version??
Yes, this is beta 2. I haven't been able to test it on the final version yet, because I can't reproduce the problem myself and we haven't shipped the new version to our customers yet.
Do you think it will work differently in the final version?
This is an issue that I haven't heard of earlier. I suggest you download the RTM of the .Net Framework and install it (remember to uninstall any beta version before installing if you intend to do this on the same machine). If your problem remains, I suggest you check the original data and code for string manipulation methods which may cause dots to disappear.
We uninstalled Beta 2 and installed RTM. This solved the problem without any changes to the code.

Saturday, March 24, 2012

trouble with click triggered events

i have a datagrid with delete text links.

I want a confirmation to be made after clicking delete once.


protected void DataGrid1_Del(object sender, DataGridCommandEventArgs e)
{
// make sure things that are invisible stay that way. Also make sure all fields are still blank.
ClearForm();
DataGrid1.EditItemIndex= -1;

MsgLabel.Text = "Are you sure you want to delete the record?";
MsgLabel.Visible = true;
CancelBtn.Visible = true;
DeleteBtn.Visible = true;

} // end DataGrid1_Del

private void DeleteBtn_Click(object sender, System.EventArgs e)
{
String deleteCmd = "DELETE from Inventory where InvName = @dotnet.itags.org.InvName";

SqlCommand myCommand = new SqlCommand(deleteCmd, sqlConnection1);
myCommand.Parameters.Add(new SqlParameter("@dotnet.itags.org.InvName", SqlDbType.NVarChar, 20));
myCommand.Parameters["@dotnet.itags.org.InvName"].Value = DataGrid1.DataKeys[(int)e.Item.ItemIndex];****

myCommand.Connection.Open();
myCommand.ExecuteNonQuery();

myCommand.Connection.Close();
dataSet11.Clear();
sqlDataAdapter1.Fill(dataSet11);

DataGrid1.DataBind();
}

What this code is SUPPOSED to do is, when the delete event is triggered, it will ask you if you are sure you want to delete the record. Upon clicking either delete or cancel, you will call the corresponding function.

The problem here is that, in my DeleteBtn_Click function, it does not recognize e.Item.ItemIndex, b/c this function e is System.EventArgs, instead of DataGridCommandEventArgs. (line is marked ****)

Does anyone have any suggestions to accomplish what I'm trying to do here?

Thanks,
TomIf I understand correctly, in "DataGrid1_Del()" can you save the "itemindex" in a session object and further use it in "DeleteBtn_Click()"?
Hope this helps
Yugang

_______________________

This posting is provided "AS IS" with no warranties, and confers no rights.
could you direct me to info on sessions? That is outside my "knowledge base." :D
Inside "DataGrid1_Del()" use code to record itemindex:
Session.Add("ItemIndex", e.Item.ItemIndex)

Inside "DeleteBtn_Click" get value from session:
Dim itenIndex As Integer = CInt(Session.Item("ItemIndex"))

For complete introduction, please refer:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsessionstate.asp

Hope this helps
Yugang
I will check the link you provided, thanks.

Initially, when I modify my code as you suggested, in the:

int itemIndex = CInt(Session.Item("ItemIndex"))

line, Session does not have a definition for "Item." (C#)

Are you sure this is correct? Like I said, I'll be checking that link.
Sorry to provide you with VB Code. For C# the code should be:
int itemIndex = int.Parse(Session["ItemIndex"].ToString())
Thanks
Yugang
cool deal, so what should I use in this line?

myCommand.Parameters["@.InvName"].Value = DataGrid1.DataKeys[(int)e.Item.ItemIndex];

What would I replace e.Item.ItemIndex with?

thanks Yugang!
ooops, as i clicked post, i saw what i was looking at, stupid me. I put

myCommand.Parameters["@.InvName"].Value = DataGrid1.DataKeys[itemIndex];

right?
Yes. Please try it
Thanks
Yugang
worked like a charm, much thanks Yugang!!!

Tom
I would stay away from the Session object (this also goes with Application) object. They have many problems (like thread affinity) which cause scaling problems.