|
I have an ASP page that is the basic 'home' location (called user_area.asp) for all of my clients who log into my website. In the user_area.asp page, it calls for some common elements with an #INCLUDE FILE statement that are standard and not variable. (Such as 'header_inc.asp' and 'footer_inc.asp')
If I have a field in my Cutsomer Data Base (.mdb) called 'Custom2' and that field would contain a URL to something like:
mysite.com / clients / clientname / client.asp
What I would need to do is be able to use the #INCLUDE FILE statement to call for the 'Custom2' field so that I could include the clients 'client.asp' within the 'user_area.asp' page.
This 'Custom2' variable in my database would change accrdingly to whomever logged into the system. Since none of the clients have the same exact download files, the 'Custom2' variable would always change and the #INCLUDE FILE statement would always point and display a seperate client.asp page withing the user_area.asp page.
Thoughts? Resolution?
Code below...
========================================================================
<%@ LANGUAGE="VBSCRIPT" %>
<% LOGIN_PAGE = "Yes" %>
<!--#INCLUDE FILE="call_check_user_inc.asp"-->
<html>
<head>
<title><% =App_Name %></title>
<script src="../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<BODY <%=BodyTag%>>
<!--#INCLUDE FILE="header_inc.asp"-->
<%
User_ID = Session("User_ID")
%>
<div align="center"><center>
<table width="650" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><font face="Arial"><font size="2"><br>
</font>
</font>
<div align="center">
<table border="0" cellpadding="0" bgcolor="#C0C0C0" cellspacing="0" width="500">
<tr>
<td colspan="3" bgcolor="#ECECE6">
<p align="center"><font face="Arial" size="1"> </font><font face="Arial" size="3"><b><% =Session("Company_Name") %>
User Area </b></font> </td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF"><font face="Arial"><font size="2">Thank you for signing in
<% =Session("First_Name") %>,</font><br>
<br>
<font size="2">
You can edit your account info from this screen. </font></td>
</tr>
<tr>
<td width="77" bgcolor="#FFFFFF"> </td>
<td width="393" bgcolor="#FFFFFF"><font size="-1"><a href="edit.asp"><font face="Geneva, Arial, Helvetica, sans-serif">Edit Account Info </font></a></font></td>
<td width="30" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"><font size="-1"><font face="Geneva, Arial, Helvetica, sans-serif"><a href="<% Response.Write(Session("Custom1")) %>">Downloads</a></font></font></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</center></div>
<br>
<br>
<!--#INCLUDE FILE="footer_inc.asp"-->
</body>
</html>
Dave Steele
|
|
|
|
|
I'm building a web accounting application in ASP.NET 2.0 using VS 2005 and SQL Express. I already developed a VB6 accounting app but re-developing in ASP.NET 2.0 is a bit difficult.
My problem is in making the form/web page look very much like the actual business form, say a sales invoice. In VB6 I could use the DBGrid control to add data but in ASP.NET 2.0 the GridView can only edit, select or delete. How to Create an Invoice-like Form in ASP NET 2.0 ?
I am at the moment trying to use a FormView for the invoice header so that I can rearrange the textboxes so that it looks like an invoice header (eg. invoice number, date on the right top edge, address on the left top edge, etc)
For the line item details (Stock Code, Description, Qty, Price and Amount) I put another FormView with a row of text boxes and an Insert link at the end and then a GridView just below it so that the columns are aligned with the input text boxes above. When users enter the input in the one-row text boxes above the grid, they can inserted into the grid row by row and the text boxes become blank again to accept new input.
I have tried to use the DetailView control to make my programming easier but I find no way to convert it into one single row rather than what it is now (1 column, a new rows for each field).
Anybody knows of a better way ?
Ezani
|
|
|
|
|
I am trying to understand how to send HTML emails to the users. The content of the emails can vary according to the users, e.g.:
Dear [CustomerName]
Thanks for your orders. Your order number is [OrderNumber].....
How can I create / manage email content such as above.
I am also interested to know how does Amazon create their emails. Because the whole content of their emails is tailored for each individual customer.
Thanks
|
|
|
|
|
Hey,
Check out Syed Moshiur Murshed's tutorial for sending email using GMail[^].
in his tutorial you can see that one of the properties he configed was:
<br />
mailMsg.BodyFormat = MailFormat.Text;<br />
MailFormat is an enum that one of his options is "HTML" that sends the email in html format (as you asked) and by using the class MailMessage you can render a html code and send it to the customer..
something like:
<br />
string customerName = ".....";<br />
long customerId = 539482;<br />
string messege = "<html><body>Hello " + customerName + " your Id is " + customerId.ToString() + "</body></html>";<br />
and then by using the Body property in MailMessage you can set the mail's text to the messege
by using:
<br />
mailMsg.Body = messege;
Hope I helped...
Good luck
Tal Kain.
|
|
|
|
|
Hello,
I have an Imagebutton with the folowing tag:
<asp:ImageButton runat="server" CommandArgument="0" ID="btnNota0" meta:resourcekey="img1" SkinID="Note0" OnClick="btnNote_Click" />
I need to create this button at runtime and adding it with the Controls.Add method.
The aspx file have a resx file in the LocalResources folder with the key "img1.Tooltip" to have the tooltip of the button localizable.
My problem is how can I create the button at runtime and use the same resource key?
Is this simple?
Thanks to everyone for the replies.
Regards
|
|
|
|
|
Dim image1 As New ImageButton
image1.ID = "btnNota0"
Panel1.Controls.Add(m)
AddHandler image1.Click, btnNote_Click
|
|
|
|
|
Hello,
I have a contact form in my web site which is working just fine on my
computer!
When I uploaded my web site to my hosting server I get an error when I
SUBMIT my form, i.e., when I click submit to send the email:
Security Exception
Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the required
permission please contact your system administrator or change the
application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Security.Permissions.FileIOPermission,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +59
System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy) +678
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share) +114
System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String
streamName) +80
System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String
streamName, Boolean assertPermissions) +115
System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String
streamName) +7
System.Configuration.Internal.DelegatingConfigHost.OpenStreamForRead(String
streamName) +10
System.Configuration.UpdateConfigHost.OpenStreamForRead(String
streamName) +42
System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
+443
Maybe the error comes from me getting data from Web.Config?
I have this code inside a custom control but here it is:
1 Private Sub bSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bSubmit.Click
2
3 ' Create new mail message
4 Dim message As New System.Net.Mail.MailMessage
5
6 ' Define mail message properties
7 With message
8
9 ' Define various properties
10 .To.Add(New System.Net.Mail.MailAddress(Me.ToAddress, Me.ToName))
11 .Body = tbMessage.Text
12 .IsBodyHtml = True
13
14 ' Define fromMailAddress
15 If Me.NameVisible Then
16 .From = New System.Net.Mail.MailAddress(tbEmail.Text, tbName.Text)
17 Else
18 .From = New System.Net.Mail.MailAddress(tbEmail.Text)
19 End If
20
21 ' Define subject
22 If Me.SubjectVisible Then
23 .Subject = tbSubject.Text
24 End If
25
26 End With
27
28 ' Create and define the SMTP client
29 Dim smtpClient As New System.Net.Mail.SmtpClient
30
31 ' Create access to configuration file
32 Dim configurationFile As Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/Web.Config")
33
34 ' Create mail settings section group
35 Dim mailSettings As System.Net.Configuration.MailSettingsSectionGroup = configurationFile.GetSectionGroup("system.net/mailSettings")
36
37 ' Define smtp client properties
38 If Not mailSettings Is Nothing Then
39 With smtpClient
40 .Port = mailSettings.Smtp.Network.Port
41 .Host = mailSettings.Smtp.Network.Host
42 .Credentials = New System.Net.NetworkCredential(mailSettings.Smtp.Network.UserName, mailSettings.Smtp.Network.Password)
43 End With
44 End If
45
46 ' Send the mail message and define sent property
47 Try
48
49 ' Send the mail message
50 smtpClient.Send(message)
51
52 ' Define sent property
53 Me.Sent = True
54
55 Catch ex As Exception
56
57 ' Define sent property
58 Me.Sent = False
59
60 End Try
61
62 ' Raise the OnFormSubmited event
63 RaiseEvent FormSubmited(Me, EventArgs.Empty)
64
65 End Sub
Maybe the problem comes from line 32? I am sure about this ...
Anyway, could someone help me out and send me some sugestions?
Thanks,
Miguel
|
|
|
|
|
Try
Dim mailSettings As System.Net.Configuration.MailSettingsSectionGroup = ConfigurationManager.GetSectionGroup("system.net/mailSettings")
and remove 32, and 35
|
|
|
|
|
Hi everybody!
I have a UserControl and all it's functionality is placed in an assembly (DLL). The UserControl generates a form with a number of TableRows containing a title, a input field and some other information. My problem is that every TableRow has a Tooltip set, and I don't want to show this. How on earth can I access the TableRow in the UserControl from the main-page's Page_Load and disable the Tooltip? My wish it that i somehow can access all the Tables TableRow's and disable them in a loop (like foreach (TableRow t in Table-placed-in-DLL-and-placed-in-usercontrol)...). Is it possible? Or do I have to solve this with javascript (hope not)?
Thank you!
pahlsson
|
|
|
|
|
If you have developed the user control then provide a public property to disable/enable tooltip by using a for each loop that loops through all tablerows and assigns a blank string
If you didn't develop, see whether the table is exposed as a property and manipulate it using server side code
|
|
|
|
|
I wan to access a control on parent form,
am trying it by using window.parent.opener.document.getElementById("control name");
actually when i see the html content of that page the control name is prefixed by
"ctl00_ctl02_control name"
so am not able to access the control with the control name can any one help me how to register and use same name in javascript also for the asp.net server control
Krishna
|
|
|
|
|
try this:
supose ur control name is abc_control then
window.parent.opener.document.getElementById('<% abc_control.ClientID %>');
|
|
|
|
|
am using asp.net 1.1 to code the web page and my virtual directory
is pointed to use asp.net 2.0 calss library (client requirement)
Can any one help me with the following error that am getting
"Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation."
Krishna
|
|
|
|
|
Krishna, how did you implement ICallbackEventHandler for 2.0? Can you post your code? I can help you if I see your code first.
Nila
"...for that, I will need a large cup of coffee and a brand muffin!" -Samantha Bea
|
|
|
|
|
You can disable post back event validation
<pages enableeventvalidation="false">
|
|
|
|
|
I am generating a high resoulution image on the web server, which should be afterward downloaded onto users machine without displaying it in the browser and requiring user to make a right click and choosing "Save image as..."
What would be the best aproach to do it?
Sincerely
Marek
|
|
|
|
|
use this:
suppose ur image is at
http://www.abc.com/images/my_image.gif
or
C:\images\my_image.gif
use a link or link button with image url like:
function Message()
{
alert('Right click on link and save...');
return false;
}
Download Image Here
|
|
|
|
|
i think my html code is not showing properly it is:
function Message()
{
alert('Right click on link and save...');
return false;
}
<<aa href="http://www.abc.com/images/my_image.gif" onclick="return Message();">Download Image Here<
replace <<aa and="" <<="" a=""> with single
|
|
|
|
|
Thanks for help, but I actually do not want any user interaction, except for specifying name for data.
When I make response.redirect("myzipfile.zip") and point to a zip file, the dialog for saving data locally appears. This ist what I want to see when I redirect to an image file, istead of displaying it.
Marek
|
|
|
|
|
Hi there,
To force the Save As dialog box at the client side, you can use the Content-Disposition header field to send the image data from the server to the client side. You can simply google for "ASP.NET Content-Disposition " to get more info.
|
|
|
|
|
Hi,
I´m a really confused about what is the best way to maintain asp.net page state (viewstate, session, profiles):
Nr 1: are all objects destroyed when a page request has finished and returned the html/aspx page? If that’s the case it conveys that I have to re-create all objects when a new request is made and “re-fill” objects with values? Or?
Nr 2: What is the usual way to “save” a users state variables?
Regards
/Christoffer
|
|
|
|
|
For information that needs to tracked across multiple post backs
a) Use View State - If the information is tied to a single page &
If the information consists of fewer bytes
b) Use Profile - If the information represents specific to the logged user on the whole
rather than a page or group of page
c) Use Session - Information that needs to be tracked for the user, that applies to your
application on the whole again use session variables, again you may not want
more than few 100 bytes of information as part of session
d) Database - If you need to track information for ordering of records and if you have few
thousands records always re-request it from the database instead of storing it
in session variables
e) Cache - If information is common across all connected users.
|
|
|
|
|
hi,
if any one knows definition of print() function in javscript
please send the code.
thank you.
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
Button1.Attributes.Add("onclick", "javascript:window.print();") If this is what you are asking?
|
|
|
|
|
(Not aimed at you personally. )
I can't understand why everyone keeps adding that protocol in front of the javascript code. As the code isn't in an url it's not even used as a protocol, but is instead wrongly interpreted as a label.
Button1.Attributes.Add("onclick", "window.print();")
If you want a label in the code, why not use something more inspired?
Button1.Attributes.Add("onclick", "mailto:window.print();")<br />
Button1.Attributes.Add("onclick", "lpt1:window.print();")<br />
Button1.Attributes.Add("onclick", "dialog:window.print();")<br />
Button1.Attributes.Add("onclick", "code:window.print();")<br />
Button1.Attributes.Add("onclick", "todo:window.print();")
---
b { font-weight: normal; }
|
|
|
|