|
|
How can i send email in asp.net by Language vb like invitation friend
to site?
|
|
|
|
|
Its in C#, but you could easily realize how to do it in vb.
MailMessage yourEmail = new MailMessage(FROM_EMAIL_ADDRESS, TO_EMAIL_ADDRESS);
yourEmail.Subject = "Your Email Subject";
SmtpClient smtpServer = new SmtpClient(SMTP_SERVER);
smtpServer.Credentials = new NetworkCredential(SMTP_USER, SMTP_PASSWORD);
smtpServer.Send(yourEmail);
Intelligence is almost useless for those who have nothing else!
Email: caiokf@gmail.com
|
|
|
|
|
Hi,
I have used cssfriendly to create a vertical menu with attractive look.Too late I discovered that it doesn't work correctly in IE6 because it jumps from the right side to the left when the mouse hover on it.Also it is shifted to the left while I made it to align to the right as it appears correctly in IE7.
Another problem I discovered is that my login control and its validation are not working correctly its code is as following:
<div style="width:50%;">
<asp:LoginView ID="logv1" runat="server">
<AnonymousTemplate>
<asp:Login ID="login1" runat="server" FailureAction="RedirectToLoginPage" DestinationPageUrl="Default.aspx" >
<LayoutTemplate>
<asp:Label ID="lblUserName" runat="server" Text="اسم المستخدم" AssociatedControlID="UserName" Width="50%" />
<asp:TextBox ID="UserName" runat="server" Width="50%" />
<asp:RequiredFieldValidator ID="vldUserName" runat="server" ValidationGroup="LoginGroup" ControlToValidate="UserName" Text="*" ErrorMessage="مطلوب اسم المستخدم"></asp:RequiredFieldValidator>
<br />
<asp:Label ID="lblPassword" runat="server" Text="كـلـمـة السـر" AssociatedControlID="Password" Width="50%" />
<asp:TextBox ID="Password" runat="server" TextMode="Password" Width="50%" />
<asp:RequiredFieldValidator ID="vldPassword" runat="server" ControlToValidate="Password" ValidationGroup="LoginGroup" Text="*" ErrorMessage="مطلوب ادخال كلمة السر"></asp:RequiredFieldValidator>
<br />
<asp:ImageButton ID="Submit" runat="server" CommandName="Login" ImageUrl="~/images/login.gif"/>
<br />
<asp:ValidationSummary ID="vldsum" runat="server" ShowMessageBox="true" ShowSummary="false" />
<br />
<asp:CheckBox ID="RememberMe" runat="server" Text="حفظ اسم الدخول"
Visible="true" />
<br />
</LayoutTemplate>
</asp:Login>
</AnonymousTemplate>
</asp:LoginView>
</div>
Which I put in login page so when access is denied it should go to this page.
The validation controls for the CreateUserWizard are not working at all what ever I do which is as following:
<div id="NewUser">
<asp:CreateUserWizard ID="createUser1" runat="server" AutoGeneratePassword="False" ContinueDestinationPageUrl="~/Default.aspx" FinishDestinationPageUrl="~/Default.aspx"
OnCreatedUser="CreateUserWizard1_CreatedUser" CreateUserButtonImageUrl="../images/btninsert.gif" CreateUserButtonType="Image"
>
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server" >
<ContentTemplate>
<div >إضافة مستخدم جديد</div>
<br />
<br />
<table cellpadding="2">
<tr>
<td class="TextField" style="width: 110px;" ><asp:Label runat="server" ID="lblUserName" Text="اسم المستخدم" AssociatedControlID="UserName" /></td>
<td class="TextField" style="width: 300px;"><asp:TextBox ID="UserName" runat="server" Width="100%"></asp:TextBox></td>
<td><asp:RequiredFieldValidator ID="valRequireUserName" runat="server" ControlToValidate="UserName" ValidationGroup="CreateUserWizard1" SetFocusOnError="true" ErrorMessage="مطلوب اسم المستخدم">*</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td class="TextField"><asp:Label runat="server" ID="lblPassword" AssociatedControlID="Password" Text="كلمة المرور" /></td>
<td class="TextField"><asp:TextBox runat="server" ID="Password" TextMode="Password" Width="100%" /></td>
<td>
<asp:RequiredFieldValidator ID="valRequirePassword" runat="server" ControlToValidate="Password" SetFocusOnError="true" Display="Dynamic"
ErrorMessage="مطلوب كلمة السر" ToolTip="مطلوب كلمة السر" ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valPasswordLength" runat="server" ControlToValidate="Password" SetFocusOnError="true" Display="Dynamic"
ValidationExpression="\W{5}" ErrorMessage="كلمة السر يجب أن لاتقل عن خمسة أحرف" ToolTip="كلمة السر يجب أن لاتقل عن خمسة أحرف"
ValidationGroup="CreateUserWizard1">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="TextField"><asp:Label runat="server" ID="lblConfirmPassword" AssociatedControlID="ConfirmPassword" Text="تأكيد كلمة المرور" /></td>
<td class="TextField"><asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" Width="100%" /></td>
<td> <asp:RequiredFieldValidator ID="valRequireConfirmPassword" runat="server" ControlToValidate="ConfirmPassword" SetFocusOnError="true" Display="Dynamic"
ErrorMessage="يلزم تأكيد كلمة المرور" ToolTip="يلزم تأكيد كلمة المرور"
ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="valComparePasswords" runat="server" ControlToCompare="Password" SetFocusOnError="true"
ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="يلزم تطابق كلمة المرور وتأكيد كلمة المرور"
ValidationGroup="CreateUserWizard1">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="TextField"><asp:Label runat="server" ID="lblEmail" AssociatedControlID="Email" Text="البريد الإلكتروني" /></td>
<td class="TextField"><asp:TextBox runat="server" ID="Email" Width="100%" /></td>
<td>
<asp:RequiredFieldValidator ID="valRequireEmail" runat="server" ControlToValidate="Email" SetFocusOnError="true" Display="Dynamic"
ErrorMessage="مطلوب البريد الإلكتروني" ToolTip="يلزم إدخال البريد الإلكتروني" ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator runat="server" ID="valEmailPattern" Display="Dynamic" SetFocusOnError="true" ValidationGroup="CreateUserWizard1"
ControlToValidate="Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ErrorMessage="البريد الإلكتروني الذي أدخلته ليس بصيغة صحيحه">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
<asp:ValidationSummary ValidationGroup="CreateUserWizard1" ID="ValidationSummary1" runat="server" ShowMessageBox="true" ShowSummary="false" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
<ContentTemplate>
<table border="0">
<tr>
<td>
تم إنشاء سجل باسم مستخدم جديد</td>
</tr>
</table>
</ContentTemplate>
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
</div>
So may be CssFriendly caused this problem too.Could any one help?
I am too late but i will never give up
|
|
|
|
|
i want to declare a webcontrol in my webservice then pass it through a function that will render it to a string then return the value. How do i declare it?
example
dim myControl as new ASP.MyWebcontrol
return RenderMy(mycontrol)
Public Function RenderMy(ByVal ctrl As Control) As String
Dim sb As New StringBuilder()
Dim tw As New IO.StringWriter(sb)
Dim hw As New HtmlTextWriter(tw)
ctrl.RenderControl(hw)
Return sb.ToString()
End Function
|
|
|
|
|
|
Hi, have a look at the following code:
aspx file
###
<body>
<form id="form1" runat="server">
<div>
<asp:GridView AutoGenerateColumns="false" ID="grdNoFlashInstances" Runat="server">
<Columns><asp:TemplateField ShowHeader="False"><ItemTemplate>
<GL:ItemWI ID="AloneItem" Width="170" runat="server"
CornerLeftTopImagePath="../App_Themes/Images/Item_Corner_Left.gif"
CenterTopImagePath="../App_Themes/Images/Item_Line.gif"
CornerRightTopImagePath="../App_Themes/Images/Item_Corner_Right.gif"
CornerLeftMiddleImagePath="../App_Themes/Images/Item_vertical.gif"
CenterMiddleBackgroundPath="../App_Themes/Images/Item_bg.gif"
CenterMiddleImagePath='<%#DataBinder.Eval(Container.DataItem, "ImageName") %>'
CornerLeftButtomImagePath="../App_Themes/Images/Item_Square2.gif"
CenterButtomImagePath="../App_Themes/Images/Item_Line.gif"
CornerRightButtomImagePath="../App_Themes/Images/Item_Square.gif.gif"
FooterLeftImagePath="../App_Themes/Images/Item_bttnleft.gif"
FooterMiddleBackgroundPath="../App_Themes/Images/Item_Header.gif"
NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "WebAddress") %>'
FooterMiddleText='<%# DataBinder.Eval(Container.DataItem, "Title") %>' />
</ItemTemplate></asp:TemplateField></Columns>
</asp:GridView>
</div>
</form>
</body>
###
code behind file:
###
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (!Page.IsPostBack)<br />
{<br />
string prePath = ConfigurationManager.AppSettings["ImageBase"].ToString();<br />
string preWIPath = ConfigurationManager.AppSettings["ImageBase"].ToString() + ConfigurationManager.AppSettings["ImageBase_WorkInstances"].ToString();<br />
WorkInstance workInstance = new WorkInstance();<br />
SqlDataReader dr;<br />
dr = workInstance.GetNotFlashItems();<br />
if (dr.HasRows)<br />
{<br />
alone<br />
grdNoFlashInstances.DataSource = dr;<br />
grdNoFlashInstances.DataBind();<br />
}<br />
dr.Close();<br />
}<br />
}
###
setting the property "CenterMiddleImagePath":
How should it be?
Answer: the saved value in database is just the filename. but path of the files should be retrieved from the file web.config and set to the variable prepath as the following. so the value of the above property is preWIPath + DataBinder.Eval(Container.DataItem, "ImageName")
string prePath = ConfigurationManager.AppSettings["ImageBase"].ToString();
string preWIPath = ConfigurationManager.AppSettings["ImageBase"].ToString() + ConfigurationManager.AppSettings["ImageBase_WorkInstances"].ToString();
QUESTION:How do I format the code in the source of the aspx file to setting the above property as said?
Trying other way:I wanted to setting the above the property in the code (.cs) file, but it say the The name 'AloneItem' does not exist in the current context?!!!
Question:How can I do it from the code file?
|
|
|
|
|
Hello, I am trying to create a custom control for creating tabs. The idea is that our designer can just use the control tags to generate the tabs. The problem that I am running into is that I want to be able to have a custom control that allows any number of child custom controls. So there would be a TabContainer Control, and within that there would be any number of tabs. The idea is similar to how an asp:DropDown list can have any number of ListItems within them. Here is my code, any help is appreciated.
1 <!-- TAB CONTAINER -->
2 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="TabContainer.ascx.vb" Inherits="CustomControls_TabContainer" %>
3 <div>
4
5 <ul class="tabs">
6 <asp:placeholder id="ph_list_items" xmlns:asp="#unknown">
7
8 </asp:placeholder>
9 </ul>
10
11 </div>
12
13
14 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Tab.ascx.vb" Inherits="CustomControls_Tab" %>
15 <li>
16 <asp:hyperlink id="hp_link" runat="server" xmlns:asp="#unknown" />
17 </li>
18
19
20 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
21 <%@ Register
22 TagPrefix="uc"
23 TagName="TabContainer"
24 src="~\CustomControls\TabContainer.ascx" %>
25 <%@ Register
26 TagPrefix="uc"
27 TagName="Tab"
28 src="~\CustomControls\Tab.ascx" %>
29
30
31
32 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head runat="server">
34 </head>
35 <body>
36 <form id="form1" runat="server">
37 <div>
38
39 <uc:tabcontainer id="tabs1" runat="server" includearrows="True" xmlns:uc="#unknown">
40 <uc:tab id="tab1" runat="server" linktext="Tab1" linkurl="http://www.google.com" />
41 <uc:tab id="tab2" runat="server" linktext="Tab1" linkurl="http://www.google.com" />
42 <uc:tab id="tab3" runat="server" linktext="Tab1" linkurl="http://www.google.com" />
43 </uc:tabcontainer>
44 </div>
45 </form>
46 </body>
47 </html>
|
|
|
|
|
Hello,
I am Working with Visual Studio 2005.
I have taken update panel(ajax), when i am using update panel, tabindex and validation controls are not working.
I can't understood why it is not working. can i have to change any properties while using update panel.
Please Help me...Urgent
Looking forward for reply
Thanks in advance...
Pinna
|
|
|
|
|
|
Hi,
I want you to help me in deploying a asp.net 2.0 web application which makes use of sql database.
Generally, the process that i follow is:
I will generate a sql script of my databse, export the data into excell file.
And, i will copy my project and create a virtual directory in the server.
Then i will run the sql script in the sql query analyser of server and import the excell data sheet.
This holds good for within the LAN.
But, now my requirement is i want to pack database and my project into a single exe file. So, that when the client installs in his server, the databse connects automatically and the project works fine...
Please help me...Its urjent.
|
|
|
|
|
You can create the scripts for the database structure as well as forthe data
In your app detect when it is the firs time use and ask the user to choose the server user and password, using that, connect to the server and execute the scripts, also save the server, user and password in webconfig for later use by your app
Alexei Rodriguez
|
|
|
|
|
Can you be more clear.?
I mean how to attach the created database scripts to web setup project.?
|
|
|
|
|
I am new a themes and skins so please bare with me. What I have is a gridview that rows contain textboxes and dropdowns in the row's columns. What I need to do is design a skin for the gridview that allows the entire row, controls and all, to appear yellow (background) once the row is selected. I have a default skin for the gridview and plan to modify this to meet my needs. Can anyone provide recommendations as to the best way to do this?
Thanks,
Steve
|
|
|
|
|
Use the designer to create a gridview with all yor requirements (Color for rows, selectedrow, edit row, etc)
Then copy all the sourcecode generated and insert it in a skin file inside a theme
You shoull only leave the properties that have to do with design, remove the is property and you can add a skinid property in the skinfile for the gridview
Example
<asp:GridView runat="server" CellPadding="2" ForeColor="#333333" GridLines="Horizontal" >
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" ForeColor="Navy" />
<PagerStyle CssClass="gridPager" BackColor="#FFCC66" ForeColor="#333333" />
<HeaderStyle CssClass="gridHeader" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
Alexei Rodriguez
|
|
|
|
|
Thanks for the help; however, let me explain my problem a bit more in detail. I do have a skin file with a skin for my gridview that works. The problem is that each of the gridview's row cells contains textboxes for data IO. Now, what I want to do is change the background color for the gridview row and that row's textboxes (showing selection) when the cursor enters one of the row's textboxes. If this sounds confusing it probably is and if more information on what I am doing is needed just let me know.
|
|
|
|
|
Convert your columns to templatecolumns
Set the necesary properties for each textboxes edit mode
Alexei Rodriguez
|
|
|
|
|
Ive never tryed this
If you are using css, try with something like this for the selectedrow or editrow:
#row
{
settings for the row
}
#row input
{
settings for input tags inside the row
}
Alexei Rodriguez
|
|
|
|
|
I have now studied themes and feel that my origional question was not accurate. What I have is a GridView with each row made up of cells containing textboxes. All I need to do is change the background of the grid's row and its textboxes once it has been selected. I do have a skin for both a non selected background and a selected background and see that I can set the SkinID property to either. All I want to do is have the background of the gridview's row and textboxes indicated that it has been selected. Can anyone provide advise?
Thanks,
Steve
|
|
|
|
|
You dont need to skins for that
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" ForeColor="Navy" />
This accomplishes what you need
Alexei Rodriguez
|
|
|
|
|
First off, thank you very much for your help. If you want me to mark this as answered as correct for you I will and post a new question, just tell me. The problem I need to solve, I think, is with textboxes that make up the cells of the grid. When I select one of the textboxes that make up the cells of the gridview, then I want the whole row, each of the row's textboxes, to be highlighted in yellow. Sorry, for my poor wording of the initial question.
Thanks again,
Steve
|
|
|
|
|
Hello,
I've developed a hosted application who's timezone is different from where data entry takes place. All historic datetime entries has been entered with a time of 00:00:00. I'm uploading data as XML and using readxml and then converting into sql 2005. The problem is readxml process subtracts 3 hours from the time and therefore pushes the date back 1 day. Since this is a batch command, how can I avoid this? I've read old posts indicating that I would have to add an offset to the time before executing the readxml. This seems like a short coming. Would eliminating thr schema help with this problem? Using VS2008 ASP 3.5, and hosted SQL 2005.
Thanks
|
|
|
|
|
Does anyone have a link for a good Themes and Skins tutorial?
Thanks,
Steve
|
|
|
|
|
Have you tried http://asp.net, they have lots of tutorials in the form of code and videos?
|
|
|
|
|
I have a web page that has a link for an attachment and that uses Javascript to popup a new window, and that new window has code in the code behind to allow the user to open/save an attachment. (It works this way because we have 3rd party software that stores all of our documents for this application).
Link (from the source):
<a href='javascript:RetrieveDocument(-9999998998)'>AnnouncementAttachment.txt</a>
Javascript:
var download_win;
function RetrieveDocument(id)
{
CloseDownload();
download_win = window.open('../Common/DocRetrieval.aspx?id=' + id,'attachment','width=1, height=1, top=0, left=0, toolbar=0, menubar=0, location=0, status=0, scrollbars=0, resizable=1');
window.onunload=CloseDownload;
}
function CloseDownload()
{
if(download_win != null)
{
download_win.close();
}
}
Code behind in DocRetrieval.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
string doc_id = Request.QueryString["id"];
//This part retrieves the document from the database
DataObjects.Document docs = new DataObjects.Document();
docs.EnforceConstraints = false;
DataObjects.Document.DocumentRow doc = docs._Document.NewDocumentRow();
doc.doc_id = long.Parse(doc_id);
docs._Document.AddDocumentRow(doc);
DataRequestChain.RequestBase req = DataRequestChain.RequestFactory.CreateRequest("GetDocument");
req.DataObject = docs;
req.ExecuteTran(); //the actual call to the db
if (!doc.Isdoc_nameNull())
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("Content-Disposition", "attachment; filename=" + doc.doc_name );
Response.AddHeader("Content-Length", doc.file.Length.ToString());
Response.ContentType = doc.content_type;
Response.BinaryWrite(doc.file);
Response.End();
}
}
Watin code in my test class:
ie = this._cpUi.CreditPlusIeWindow; //(already set up)
this._cpUi.Detail.Frame.Link(Find.ByText(FILE_NAME)).Click(); //This is the link for the attachment
cpUi.CatchPopupIEWithoutBaseUrl(docRetrievalURL, false); //This catches DocRetrieval.aspx and puts a pointer to it in cpUi
Assert.That(cpUi.CreditPlusIeWindow.Url.ToUpper().Contains(docRetrievalURL.ToUpper())); //Make sure we have our DocRetrieval page
//Handle the open/save file dialog
FileDownloadHandler dialogHandler = new FileDownloadHandler(FileDownloadOption.Open);
ie = cpUi.CreditPlusIeWindow;
WatiN.Core.DialogHandlers.FileDownloadHandler baseDialog = new WatiN.Core.DialogHandlers.FileDownloadHandler(FileDownloadOption.Open);
ie.DialogWatcher.Add(dialogHandler);
baseDialog.WaitUntilFileDownloadDialogIsHandled(15);
The WaitUntilFileDownloadDialogIsHandled doesn't do anything, it waits for 15 seconds and then throws an exception that it's not handled. The dialog that pops up immediately goes away, I'm not sure why, I would think the baseDialog was clicking the "ok" but that is not apparent in the few seconds that dialog is up, and a file will never open. I'm not sure how to use Watin to handle this. The whole point of the test is to make sure the attachment was stored correctly. I.e. we are able to open it from the original web page. Any help would be appreciated!! Thanks!
|
|
|
|