Hi.. yes I already filled up a dropdown list coming from SQL data as my datasource. But I dont know how to code the second part that you are saying.
"Secondly on the selectedindex change event of the first dropdown list bind the second dropdownlist(getting the corresponding data from the database).
To fill the second dropdownlist you have to pass the selected items ID(i.e. departments ID) in order to get the correct set of records."
Can you show me in vb.net code? I really appreciate it. Thanks.
What you need to do in the second part is you have to get the ID value of the item selected in the department dropdownlist(when you would have bind the first dropdownlist then you would have assigned the text and value field, you need to get that value of the selected item). And once you are having that you can query to get the records associated with that department ID. And once you get the desired records you have to bind the second dropdown exactly like you have done with the first one. I think now it would have been clear.
In my Asp .net Application.. I need to store the date in a variable.. For that i wrote the following code
Dim thisDate, startDate, endDate As Date
Dim thisMonth, thisYear As Integer
thisDate = Now.Date
thisMonth = Month(thisDate)
thisYear = Year(thisDate)
If thisMonth = 1 Or 3 Or 5 Or 7 Or 8 Or 10 Or 12 Then
startDate = "1/thisMonth/thisYear"
endDate = "31/thisMonth/thisYear"
ElseIf thisMonth = 4 Or 6 Or 9 Or 11 Then
startDate = "1/thisMonth/thisYear"
endDate = "30/thisMonth/thisYear"
startDate = "1/thisMonth/thisYear"
endDate = "28/thisMonth/thisYear"
But it shows the error message as,
Cast from string "1/thisMonth/thisYear" to type 'Date' is not valid.
Can i access the controls data in codebehind ? i dont see it getting enumerated in the Controls collection ?
foreach (Control c in Controls)
Response.Write(c.ClientID.ToString() + c.GetType().ToString() + " ");
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.
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).
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..
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
mailMsg.Body = messege; //assuming mailMsg is the object of MailMessage<br />
I have a contact form in my web site which is working just fine on my
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:
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=126.96.36.199, Culture=neutral,
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.
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
3 ' Create new mail message
4 Dim message As New System.Net.Mail.MailMessage
6 ' Define mail message properties
7 With message
9 ' Define various properties
10 .To.Add(New System.Net.Mail.MailAddress(Me.ToAddress, Me.ToName))
11 .Body = tbMessage.Text
12 .IsBodyHtml = True
14 ' Define fromMailAddress
15 If Me.NameVisible Then
16 .From = New System.Net.Mail.MailAddress(tbEmail.Text, tbName.Text)
18 .From = New System.Net.Mail.MailAddress(tbEmail.Text)
19 End If
21 ' Define subject
22 If Me.SubjectVisible Then
23 .Subject = tbSubject.Text
24 End If
26 End With
28 ' Create and define the SMTP client
29 Dim smtpClient As New System.Net.Mail.SmtpClient
31 ' Create access to configuration file
32 Dim configurationFile As Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/Web.Config")
34 ' Create mail settings section group
35 Dim mailSettings As System.Net.Configuration.MailSettingsSectionGroup = configurationFile.GetSectionGroup("system.net/mailSettings")
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
46 ' Send the mail message and define sent property
49 ' Send the mail message
52 ' Define sent property
53 Me.Sent = True
55 Catch ex As Exception
57 ' Define sent property
58 Me.Sent = False
60 End Try
62 ' Raise the OnFormSubmited event
63 RaiseEvent FormSubmited(Me, EventArgs.Empty)
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?
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."
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?
Last Visit: 31-Dec-99 19:00 Last Update: 3-Dec-23 8:27