|
Dear All,
How can I send an email of an HTML page showing the results of inquiries made by the client in the exact format displayed on the web-page. Is there a way to read the HTML and put it as the body of the email...
Thanks alot...
E.E.
|
|
|
|
|
Just create an object of MailMessage and set the html in body property and send the mail with IsBodyHtml = true.
Your problem will be solved.
|
|
|
|
|
|
Dim SB as New StringBuilder()
Dim SW as New StringWriter(SB)
Dim htmlTW as New HtmlTextWriter(SW)
dgPopularFAQs.RenderControl(htmlTW)
Actually I am looking for this, however I did not understand what this code is doing... and why I need htmlwriter besides a stringwriter... but in anycase
I hope Page.render(htmltw) will solve my problem and will attach whole page to SB...
Thanks again
|
|
|
|
|
In my ASP.NET project I have some aspx pages and a webservice(asmx) which get called with ASP.NET AJAX. Now the aspx pages just check for session to get the logged in persons username(for relevant SQL calls) but I had trouble doing the same with my asmx file. I tried a couple different methods after searching but most results are for getting sessions in an ashx file, and the same principals dont work.
So what I did was create a public string in my webservice that, on logging in, the aspx page changed to the users name. But then when I checked username it was always just the last person that had logged in, for obvious reasons.
So how do I check for sessions in an asmx page?
Thanks alot
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
You need to enable sessions in your webservice..
[WebMethod(EnableSession = true)]
public bool HelloWorld()
{
return true;
}
|
|
|
|
|
|
Hi i want to apply them in content page, where i want to write code.
after register assembly i written code error coming, after content place holder i written there also error coming
where i want to write that code,
<link href="../App_Themes/Blue/DefStyles.css" rel="stylesheet" type="text/css" /> this code where i want to write?
plz replay me.
|
|
|
|
|
I'm not sure I understand. What error ?
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.
|
|
|
|
|
Sample Code of my Content page
<%@ Page Language="C#" MasterPageFile="~/common/MasterPage.master" AutoEventWireup="true"<br />
CodeFile="AdminSetting.aspx.cs" Inherits="admin_AdminSetting" %><br />
<br />
<%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics2.WebUI.UltraWebGrid.v7.3, Version=7.3.20073.1043, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %><br />
<br />
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server" ><br />
<br />
<table border="0" cellpadding="0" cellspacing="0" style="height: 100%" align="left"><br />
<br />
<tr><br />
<td style="height: 10px; width: 903px;" valign="top"><br />
<asp:ScriptManagerProxy id="ScriptManagerProxy1" runat="server"><br />
<scripts><br />
<asp:ScriptReference Path="~/scripts/Admin_grid.js" /><br />
</scripts><br />
</asp:ScriptManagerProxy><br />
</td><br />
<td><br />
</td><br />
</tr><br />
</table><br />
</asp:Content>
in this page where i want to apply them?
<link href="../App_Themes/Blue/DefStyles.css" rel="stylesheet" type="text/css" />
|
|
|
|
|
If You Dont Know Where to write ..!I think this is style sheet..!
So Go to the design view of the required page drag and drop the style sheet on the page..!
If i Misunderstood please explain in detail..!
Exactly what do u want to do?
What did you do?
When is the error comming..?
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
thnx a lot friend
So Go to the design view of the required page drag and drop the style sheet on the page..!
it is working for me.
|
|
|
|
|
pss.srinivasan wrote: thnx a lot friend
Any Time..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi,
You can write this in
<br />
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"><br />
</asp:Content><br />
of the content page.
cheers,
sneha
|
|
|
|
|
hi what u send like that i written code but this error coming
Error 40
Cannot switch views: Validation (XHTML 1.0 Transitional):
Element 'link' cannot be nested within element 'td'.
my code is like this
<br />
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server" ><br />
<link href="../App_Themes/Blue/DefStyles.css" rel="stylesheet" type="text/css" /><br />
</asp:Content><br />
|
|
|
|
|
Hi,
You must be having a ContentPlaceHolder tag in the of the master page, you are using. Then in the content page there must be content tag having that contentPlaceHolderID. You can put the link tag in that <content>.
cheers,
sneha
modified on Tuesday, November 17, 2009 6:14 AM
|
|
|
|
|
Hi to all,
I am working on an advanced search module. It consist of 6 fields given to user to fill and search. The user can fill any one or two and may be all the fields to search. Some fields are text based and some are float.
The logic is that after taking the input, the application should check which fields are filled up by the user. And neglect the fields which are not filled from the sql query.
What I did is that, I fetched all the values from the textboxes and the values which are not empty has been added to a arraylist. Now I got the filledup values. But application will know that it is productid, description or what...
Please assist me.
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["newcon"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
ArrayList arl = new ArrayList();
if (TextBox1.Text.Trim() != "")
{
arl.Add("productid");
}
if (TextBox2.Text.Trim() != "")
{
arl.Add("sh_desc");
}
if (TextBox3.Text.Trim() != "")
{
arl.Add("weight");
}
if (TextBox4.Text.Trim() != "")
{
arl.Add("length");
}
if (TextBox5.Text.Trim() != "")
{
arl.Add("width");
}
if (TextBox6.Text.Trim() != "")
{
arl.Add("height");
}
for (int i = 0; i <= arl.Count; i++ )
{
if (arl[i].ToString().StartsWith("productid"))
{
}
}
cmd.CommandText = "select sh_desc,productid,price from PRODUCTS where ";
cmd.Connection.Open();
dt = new DataTable();
dt.Columns.Add("REF", typeof(string));
dt.Columns.Add("Description", typeof(string));
dt.Columns.Add("Price", typeof(float));
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
pr_id = (rdr["productid"]).ToString();
testsh_desc = (rdr["sh_desc"]).ToString();
test_price = Convert.ToSingle(rdr["price"]);
DataRow myrow = dt.NewRow();
myrow["REF"] = pr_id;
myrow["Description"] = testsh_desc;
myrow["Price"] = test_price;
dt.Rows.Add(myrow);
dt.AcceptChanges();
Session["sear"] = dt;
}
if (testsh_desc != null)
{
Response.Redirect("~/Results.aspx");
}
else
{
Response.Redirect("~/ErrorResult.aspx");
}
cmd.Connection.Close();
}
cheers,
sneha
|
|
|
|
|
Hi ,
I think u can prepare u query based on input how many valuse is filled by the user based on this u can concat string. and get result
Thanks and regards,
Amit PAtel
|
|
|
|
|
Hi Amit,
Thanks for the reply. I am the count of the values filled by the user through arraylist. Suppose I get 3 values but how I will know that these 3 values are which values. Is it a product id, description and short description or it is price, weight and length.
Please provide me an example if you have..I am confused..
cheers,
sneha
|
|
|
|
|
Hi sneha,
what i am saying u need to put if and else in ur code.
intially ur query will be like this
String query = Select * from urtablename where
if(product id!=null)
{
query = query +"product id = input"
}
if(price)
{
query =query+ add ur query;
}
thanks and regars
|
|
|
|
|
I suspect your best bet is to build your SQL based on what fields were entered.
Doing a response.redirect obviously means throwing away the results you've found, and the data that has been entered.
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.
|
|
|
|
|
you mean to say if I have 3 fields. Then I should use all the permutations and combinations.
That is if
all three are filled
none is filled
1 is not filled , 2 & 3 are filled
.
.
.
.
.
cheers,
sneha
|
|
|
|
|
Hi sneha,
what i am saying u need to put if and else in ur code.
intially ur query will be like this
String query = Select * from urtablename where
if(product id!=null)
{
query = query +"product id = input"
}
if(price)
{
query =query+ add ur query;
}
thanks and regars
amit patel
|
|
|
|
|
Ok I got it. I will try like this and came back to you with the results.
cheers,
sneha
|
|
|
|
|
Hi
u can uee dictionary collection to store key value pair.
Thanks and regards,
Amit
|
|
|
|