codefinger
asked on
Position Properties of a web form?
I am building my first web application in vb.net and have run into some things I do not understand...
For one, I read about a property called something like "MaintainPositionOnAutoPos tBack", but I cannot find that property on any of my web forms.
Also, I would like to have the web form have a center screen start position, cannot find that property either.
Where am I not looking that I should be?
Thanks!
For one, I read about a property called something like "MaintainPositionOnAutoPos
Also, I would like to have the web form have a center screen start position, cannot find that property either.
Where am I not looking that I should be?
Thanks!
ASKER
Okay, the actual name of the property is "MaintainScrollPostionOnPo stBack" and it turns out it is a statement that is added to the Page statement at the beginning of the aspx portion of the document:
So I was never going to find it in the properties dialog until VS2010 adds a property page for that!
<%@ Page Language="vb" MaintainScrollPositionOnPo stback="tr ue" AutoEventWireup="false" CodeBehind="UserDetails.as px.vb" Inherits="MyChartInternal. UserDetail s" %>
So that should take care of my page jumping like an earthquake has hit everytime someond clicks a radio button or a check box or makes a choice from a drop down list.
So I was never going to find it in the properties dialog until VS2010 adds a property page for that!
<%@ Page Language="vb" MaintainScrollPositionOnPo
So that should take care of my page jumping like an earthquake has hit everytime someond clicks a radio button or a check box or makes a choice from a drop down list.
ASKER
Looks like I spoke too soon.
I tried my own suggestion and now I am getting
Microsoft JScript runtime error: 'theForm.__SCROLLPOSITIONX .value' is null or not an object
coming from code I did not write.
Any ideas? Any one? (I hate Sunday nights).
I tried my own suggestion and now I am getting
Microsoft JScript runtime error: 'theForm.__SCROLLPOSITIONX
coming from code I did not write.
Any ideas? Any one? (I hate Sunday nights).
I've found MaintainScrollPositionOnPo stback to be a waste of time because it doesn't work on all browsers. The best solution I've found is here: http://www.4guysfromrolla. com/articl es/111704- 1.aspx
To summerise, copy the dll into the servers bin directory, add a reference to the control:
<%@ Register TagPrefix = "sstchur" Namespace = "sstchur.web.SmartNav" Assembly = "sstchur.web.SmartNav" %>
Then add an instance of the control:
<sstchur:SmartScroller runat = "server" />
To summerise, copy the dll into the servers bin directory, add a reference to the control:
<%@ Register TagPrefix = "sstchur" Namespace = "sstchur.web.SmartNav" Assembly = "sstchur.web.SmartNav" %>
Then add an instance of the control:
<sstchur:SmartScroller runat = "server" />
ASKER
Seonyx:
I am using VS 2010.
How will the approach be different in that IDE?
Thanks!
I am using VS 2010.
How will the approach be different in that IDE?
Thanks!
I don't use VS much myself but I just tried this out with VS Express.
Download the zip with all the files in it. Extract the file sstchur.web.SmartNav.dll and drop it on to the bin folder in solution explorer (or just copy it up there with ftp. (If there isn't a bin folder already just make one.)
Open up the page with the web form in it. Paste the line <%@ Register TagPrefix = "sstchur" Namespace = "sstchur.web.SmartNav" Assembly = "sstchur.web.SmartNav" %> near the top of the file (It will probably be the 2nd line after the page language line.)
Then paste the line <sstchur:SmartScroller runat = "server" /> somewhere on the page - it doesn't really matter where as long as it's inside the form tag that will be running on the server. Save the page and that's it - you're good to go.
Download the zip with all the files in it. Extract the file sstchur.web.SmartNav.dll and drop it on to the bin folder in solution explorer (or just copy it up there with ftp. (If there isn't a bin folder already just make one.)
Open up the page with the web form in it. Paste the line <%@ Register TagPrefix = "sstchur" Namespace = "sstchur.web.SmartNav" Assembly = "sstchur.web.SmartNav" %> near the top of the file (It will probably be the 2nd line after the page language line.)
Then paste the line <sstchur:SmartScroller runat = "server" /> somewhere on the page - it doesn't really matter where as long as it's inside the form tag that will be running on the server. Save the page and that's it - you're good to go.
ASKER
Tried it, but it gives me an error as soon as the page loads, which is worse than the error I was getting with MaintainScrollPositionOnPo stback also (screen shot attached). Since its error is very similar to the one I get with MaintainScrollPositionOnPo stback, I suspect I may have some malformed html, but VS 2010 is not giving me any clues where the problem might be.
ScriptErrorScreenShot3.doc
ScriptErrorScreenShot3.doc
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="UserDetails.aspx.vb" Inherits="MyChartInternal.UserDetails" %>
<%@ Register TagPrefix = "sstchur" Namespace = "sstchur.web.SmartNav" Assembly = "sstchur.web.SmartNav" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>My Ochsner - HIM Access </title>
<link href="ochsner_reg.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrap">
<div id="banner"></div>
<div id="main">
<h2>Online Registration - HIM Access</h2>
<h3>All fields with an asterisk are required.</h3>
<form id="form1" runat="server">
<sstchur:SmartScroller runat = "server" />
<table id="tblcontent">
<tr>
<td>
<div class="item">
<asp:Label ID="LabelFirstName" runat="server" Text="* First Name" ></asp:Label>
<asp:TextBox ID="TextBoxFirstName" runat="server"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
BackColor="White" ControlToValidate="TextBoxFirstName"
ErrorMessage="Required Field" ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<br />
<div class="item">
<asp:Label ID="LabelLastName" runat="server" Text="* Last Name" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxLastName" runat="server"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
BackColor="White" ControlToValidate="TextBoxLastName"
ErrorMessage="Required Field" ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<div class="item">
<asp:Label ID="LabelSSN" runat="server" Text="* SSN" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxSSN" runat="server"
ToolTip="Format: XXX-XX-XXXX"></asp:TextBox><div class="hint">
XXX-XX-XXXX
</div>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server"
ControlToValidate="TextBoxSSN" ErrorMessage="RegularExpressionValidator"
ForeColor="Red" ValidationExpression="\d{3}-\d{2}-\d{4}">Please format: XXX-XX-XXXX</asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
BackColor="White" ControlToValidate="TextBoxSSN" ErrorMessage="Required Field"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
</div>
<div class="item">
<asp:Label ID="LabelDOB" runat="server" Text="* Date Of Birth" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxDOB" runat="server"
ToolTip="Format: XX/XX/XXXX"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
BackColor="White" ControlToValidate="TextBoxDOB" ErrorMessage="Required Field"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator2" runat="server"
ControlToValidate="TextBoxDOB" Display="Dynamic"
ErrorMessage="CompareValidator" ForeColor="Red" Operator="DataTypeCheck"
Type="Date">Not a valid date</asp:CompareValidator></div>
</td>
<td>
<div class="item">
<label>Gender</label>
<asp:RadioButtonList ID="RadioButtonGender" runat="server" RepeatLayout="Flow"
Height="103px" RepeatDirection="Horizontal" TextAlign="Left">
<asp:ListItem Value="M">Male</asp:ListItem>
<asp:ListItem Value="F">Female</asp:ListItem>
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"
ControlToValidate="RadioButtonGender" ErrorMessage="Required Field"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<br />
<br />
<div class="item">
<asp:Label ID="Label2" runat="server" Text="Clinic Number:" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxClinicNo" runat="server" ></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server"
ControlToValidate="TextBoxClinicNo" ErrorMessage="Required Field"
ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<br />
<br />
<div class="item">
<asp:Label ID="LabelPhoneNo" runat="server" Text="* Phone Number" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxPhoneNo" runat="server"
ToolTip="Format: (XXX) XXX-XXXX"></asp:TextBox><div class="hint">(XXX) XXX-XXXX
</div>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server"
ControlToValidate="TextBoxPhoneNo" ErrorMessage="Required Field"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ControlToValidate="TextBoxPhoneNo" Display="Dynamic"
ErrorMessage="RegularExpressionValidator" ForeColor="Red"
ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}">Please format: (XXX) XXX-XXXX</asp:RegularExpressionValidator></div>
<br />
<br />
<div class="item">
<asp:Label ID="LabelEmail" runat="server" Text="* Email" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxEmail" runat="server" ></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
BackColor="White" ControlToValidate="TextBoxEmail"
ErrorMessage="Required Field" ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBoxEmail" Display="Dynamic"
ErrorMessage="RegularExpressionValidator" ForeColor="Red"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Not a valid email address.</asp:RegularExpressionValidator></div>
</td>
<td>
<div class="item">
<asp:Label ID="LabelAddress1" runat="server" Text="* Address1" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxAddress1" runat="server" ></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
BackColor="White" ControlToValidate="TextBoxAddress1"
ErrorMessage="Required Field" ForeColor="Red"></asp:RequiredFieldValidator></div>
<br />
<div class="item">
<asp:Label ID="LabelAddress2" runat="server" Text="Address2" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxAddress2" runat="server" ></asp:TextBox></div>
<div class="item">
<asp:Label ID="LabelCity" runat="server" Text="* City" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxCity" runat="server" ></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
BackColor="White" ControlToValidate="TextBoxCity"
ErrorMessage="Required Field" ForeColor="Red"></asp:RequiredFieldValidator></div>
<div class="item">
<asp:Label ID="LabelState" runat="server" Text="* State" ></asp:Label>
<br />
<asp:DropDownList ID="DropDownListState" runat="server"
CausesValidation="True" >
<asp:ListItem Value=AL>Alabama</asp:ListItem>
<asp:ListItem Value=AK>Alaska</asp:ListItem>
<asp:ListItem Value=AZ>Arizona</asp:ListItem>
<asp:ListItem Value=AR>Arkansas</asp:ListItem>
<asp:ListItem Value=CA>California</asp:ListItem>
<asp:ListItem Value=CO>Colorado</asp:ListItem>
<asp:ListItem Value=CT>Connecticut</asp:ListItem>
<asp:ListItem Value=DC>District of Columbia</asp:ListItem>
<asp:ListItem Value=DE>Delaware</asp:ListItem>
<asp:ListItem Value=FL>Florida</asp:ListItem>
<asp:ListItem Value=GA>Georgia</asp:ListItem>
<asp:ListItem Value=HI>Hawaii</asp:ListItem>
<asp:ListItem Value=ID>Idaho</asp:ListItem>
<asp:ListItem Value=IL>Illinois</asp:ListItem>
<asp:ListItem Value=IN>Indiana</asp:ListItem>
<asp:ListItem Value=IA>Iowa</asp:ListItem>
<asp:ListItem Value=KS>Kansas</asp:ListItem>
<asp:ListItem Value=KY>Kentucky</asp:ListItem>
<asp:ListItem Value=LA>Louisiana</asp:ListItem>
<asp:ListItem Value=ME>Maine</asp:ListItem>
<asp:ListItem Value=MD>Maryland</asp:ListItem>
<asp:ListItem Value=MA>Massachusetts</asp:ListItem>
<asp:ListItem Value=MI>Michigan</asp:ListItem>
<asp:ListItem Value=MN>Minnesota</asp:ListItem>
<asp:ListItem Value=MS>Mississippi</asp:ListItem>
<asp:ListItem Value=MO>Missouri</asp:ListItem>
<asp:ListItem Value=MT>Montana</asp:ListItem>
<asp:ListItem Value=NE>Nebraska</asp:ListItem>
<asp:ListItem Value=NV>Nevada</asp:ListItem>
<asp:ListItem Value=NH>New Hampshire</asp:ListItem>
<asp:ListItem Value=NJ>New Jersey</asp:ListItem>
<asp:ListItem Value=NM>New Mexico</asp:ListItem>
<asp:ListItem Value=NY>New York</asp:ListItem>
<asp:ListItem Value=NC>North Carolina</asp:ListItem>
<asp:ListItem Value=ND>North Dakota</asp:ListItem>
<asp:ListItem Value=OH>Ohio</asp:ListItem>
<asp:ListItem Value=OK>Oklahoma</asp:ListItem>
<asp:ListItem Value=OR>Oregon</asp:ListItem>
<asp:ListItem Value=PA>Pennsylvania</asp:ListItem>
<asp:ListItem Value=RI>Rhode Island</asp:ListItem>
<asp:ListItem Value=SC>South Carolina</asp:ListItem>
<asp:ListItem Value=SD>South Dakota</asp:ListItem>
<asp:ListItem Value=TN>Tennessee</asp:ListItem>
<asp:ListItem Value=TX>Texas</asp:ListItem>
<asp:ListItem Value=UT>Utah</asp:ListItem>
<asp:ListItem Value=VT>Vermont</asp:ListItem>
<asp:ListItem Value=VA>Virginia</asp:ListItem>
<asp:ListItem Value=WA>Washington</asp:ListItem>
<asp:ListItem Value=WV>West Virginia</asp:ListItem>
<asp:ListItem Value=WI>Wisconsin</asp:ListItem>
<asp:ListItem Selected="True" Value="NONE">(Not Selected)</asp:ListItem>
</asp:DropDownList>
<br />
<asp:CustomValidator ID="CustomValidator1" runat="server"
ControlToValidate="DropDownListState" ErrorMessage="Required Field"
OnServerValidate="ValidateState" EnableClientScript="False" ForeColor="Red">Required Field</asp:CustomValidator> </div>
<div class="item">
<asp:Label ID="LabelZip" runat="server" Text="* Zip Code" ></asp:Label>
<br />
<asp:TextBox ID="TextBoxZip" runat="server" style="text-align:right"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
BackColor="White" ControlToValidate="TextBoxZip" ErrorMessage="Required Field"
ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator></div>
</td></tr></table>
<%-- </div>--%>
<%-- <div>--%>
<div>
<div class="item">
<asp:Label ID="Label5" runat="server" Text="Approve/Deny:"></asp:Label>
<asp:DropDownList ID="DropDownListApprove" runat="server"
AutoPostBack="True">
<asp:ListItem Selected="True">Not Decided</asp:ListItem>
<asp:ListItem>Approved</asp:ListItem>
<asp:ListItem>Denied</asp:ListItem>
<asp:ListItem>Rejected</asp:ListItem>
</asp:DropDownList>
<asp:CheckBox ID="CheckBoxDenial" runat="server" Text="Denial Email Sent"
Visible="False" />
<asp:CheckBox ID="CheckBoxRejected" runat="server"
Text="Rejected Email Sent" Visible="False" Enabled="False" />
<asp:CheckBox ID="CheckBoxApproval" runat="server"
Text="Approval Letter Mailed" Enabled="False" />
<asp:Button ID="ButtonReSend" runat="server" Text="Re-send"
Visible="False" CssClass="button" /> </div></div>
<br />
<div class="item">
<asp:Label ID="Label6" runat="server" Text="Notes (3000 characters):"
></asp:Label>
<asp:TextBox ID="TextBoxNotes" runat="server" Height="65px" MaxLength="3000"
Width="264px" AutoPostBack="True" TextMode="MultiLine"></asp:TextBox></div>
<br /><br /><br />
<div align="center">
<asp:Button ID="ButtonSubmit" runat="server" Text="Submit" CssClass="button" />
</div>
<%--</div>--%>
<%--</div>--%>
</form></div></div>
<div id="footer">
</div>
</body>
</html>
Can you post the codebehind and I'll take another look at it..
ASKER
ok...
Imports System.Net.Mail
Public Class UserDetails
Inherits System.Web.UI.Page
Public CurrentRecordID As Integer = 0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim pr As MyChartRegistration.BDL.DOBJ.DataObjects.PatientRegistration
pr = Session("PatientDetails")
If Not pr Is Nothing Then
CurrentRecordID = Session("CurrentRecordID")
Me.TextBoxClinicNo.Text = pr.ClinicNo
Me.TextBoxFirstName.Text = pr.FirstName
Me.TextBoxLastName.Text = pr.LastName
Me.TextBoxEmail.Text = pr.Email
Me.RadioButtonGender.SelectedValue = pr.Gender
Me.TextBoxPhoneNo.Text = pr.Phone_Number
Me.TextBoxDOB.Text = pr.DOB
Me.TextBoxSSN.Text = pr.SSN
Me.TextBoxAddress1.Text = pr.Address1
Me.TextBoxAddress2.Text = IIf(pr.Address2 = " ", String.Empty, pr.Address2)
Me.TextBoxCity.Text = pr.City
Me.DropDownListState.SelectedValue = pr.State
Me.TextBoxZip.Text = pr.Zip
Me.DropDownListApprove.SelectedValue = pr.Status
If pr.Status.ToUpper = "DENIED" Then
Me.CheckBoxDenial.Visible = True
Else
Me.CheckBoxDenial.Visible = False
End If
If pr.Status.ToUpper = "REJECTED" Then
Me.CheckBoxRejected.Visible = True
Else
Me.CheckBoxRejected.Visible = False
End If
If pr.Status.ToUpper = "APPROVED" Then
Me.CheckBoxApproval.Visible = True
Else
Me.CheckBoxApproval.Visible = False
End If
Me.TextBoxNotes.Text = pr.Notes
Me.CheckBoxRejected.Checked = IIf(pr.Rejected_Email_Sent, True, False)
Me.CheckBoxDenial.Checked = IIf(pr.Denial_Email_Sent, True, False)
Me.CheckBoxApproval.Checked = IIf(pr.Approval_Letter_Sent, True, False)
End If
End If
End Sub
Public Function FileToString(ByVal strfilename As String) As String
Dim strfilereader As New System.IO.StreamReader(strfilename)
Dim retval As String = Nothing
Try
retval = strfilereader.ReadToEnd()
Catch ex As Exception
Session("Error Message") = ex.Message
If Not ex.InnerException Is Nothing Then
Session("Error Message") = ex.Message & " " & ex.InnerException.Message
End If
Server.Execute("WebFormError.aspx")
retval = Nothing ' this should prevent any email from being sent, even an error message.
End Try
Return retval
End Function
Protected Sub ButtonSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonSubmit.Click
Dim strerrmsg As String = Nothing
Dim str_username As String = Nothing
Dim pr As New MyChartRegistration.BDL.DOBJ.InputParameters.PatientInputParms
Dim ptcls As New MyChartRegistration.BDL.DOBJ.DataObjects.PatientRegistration
pr.PatClass = ptcls
Dim dt As New MyChartRegistration.BDL.MyChartTransactions.BL.DataTransactions
Dim dq As New MyChartRegistration.BDL.MyChartRegistration.BL.DataQueries
pr.PatClass.RecordID = Session("CurrentRecordID")
pr.PatClass.ClinicNo = Me.TextBoxClinicNo.Text
pr.PatClass.FirstName = Me.TextBoxFirstName.Text
pr.PatClass.LastName = Me.TextBoxLastName.Text
pr.PatClass.Email = Me.TextBoxEmail.Text
pr.PatClass.Gender = Me.RadioButtonGender.SelectedValue
pr.PatClass.Phone_Number = Me.TextBoxPhoneNo.Text
pr.PatClass.DOB = Me.TextBoxDOB.Text
pr.PatClass.SSN = Me.TextBoxSSN.Text
pr.PatClass.Address1 = Me.TextBoxAddress1.Text
pr.PatClass.Address2 = IIf(Trim(Me.TextBoxAddress2.Text).Length > 0, Me.TextBoxAddress2.Text, String.Empty)
pr.PatClass.City = Me.TextBoxCity.Text
pr.PatClass.State = Me.DropDownListState.SelectedValue
pr.PatClass.Zip = Me.TextBoxZip.Text
pr.PatClass.Status = Me.DropDownListApprove.SelectedValue
pr.PatClass.Notes = Me.TextBoxNotes.Text
If Me.CheckBoxDenial.Checked Then
pr.PatClass.Denial_Email_Sent = True
Else
pr.PatClass.Denial_Email_Sent = False
End If
If Not Page.IsValid Then
Exit Sub
End If
Try
pr.PatClass.Status = Me.DropDownListApprove.SelectedValue
Select Case Me.DropDownListApprove.SelectedValue.ToUpper
Case "DENIED"
If Not Me.CheckBoxDenial.Checked Then
Dim em As New MyChartRegistration.BDL.DOBJ.DataObjects.EmailMessage
em.Subject = "Re:Request for MyChart Web Access"
em.SendTo = Me.TextBoxEmail.Text
' em.Body = FileToString(ConfigurationManager.AppSettings("DENIAL_EMAIL_LOCATION"))
em.Body = FileToString(HttpContext.Current.Server.MapPath(".") & "\Correspondence\" & "Denied.htm")
If Not SendEmail(em, strerrmsg) Then
Session("Error Message") = "Error sending email " & strerrmsg
Server.Execute("WebformError.aspx")
Else
pr.PatClass.Denial_Email_Sent = True
End If
End If
If dt.UpdatePatientDetailsInOracle(pr) Then
Session("PatientDetails") = pr.PatClass
Server.Execute("WebFormDenied.aspx")
Else
Session("Error Message") = dt.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
Exit Sub
End If
Case "REJECTED"
If Not Me.CheckBoxRejected.Checked Then
Dim em As New MyChartRegistration.BDL.DOBJ.DataObjects.EmailMessage
em.Subject = "Re:Request for MyChart Web Access"
em.SendTo = Me.TextBoxEmail.Text
'em.Body = FileToString(ConfigurationManager.AppSettings("REJECTED_EMAIL_LOCATION"))
em.Body = FileToString(HttpContext.Current.Server.MapPath(".") & "\Correspondence\" & "REJECTED.HTM")
If pr.PatClass.USERNAME Is Nothing Then
If dq.GetUserName(pr, str_username) Then
pr.PatClass.USERNAME = str_username
End If
End If
em.Body.Replace("PATIENT_USER_NAME", pr.PatClass.USERNAME)
If Not SendEmail(em, strerrmsg) Then
Session("Error Message") = "Error sending email " & strerrmsg
Server.Execute("WebFormError.aspx")
Exit Sub
Else
pr.PatClass.Rejected_Email_Sent = True
If dt.UpdatePatientDetailsInOracle(pr) Then
Session("PatientDetails") = pr.PatClass
Server.Execute("WebFormEpicReject.aspx")
Exit Sub
Else
Session("Error Message") = dt.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
Exit Sub
End If
End If
End If
Case "APPROVED"
Dim str_approval_text As String
Dim dt2 As New MyChartRegistration.BDL.MyChartTransactions.BL.DataTransactions
Dim thisday As DateTime
thisday = Now()
Dim str_message As String = Nothing
Dim int_retval As Integer = 0
Dim str_pinno As String = ""
If dt.RequestApproval(pr, str_message, int_retval) Then
Select Case int_retval
Case 0 ' No matching patient -- demographics are off somewhere.
pr.PatClass.Status = "Rejected"
If Not Me.CheckBoxRejected.Checked Then
Dim em As New MyChartRegistration.BDL.DOBJ.DataObjects.EmailMessage
em.Subject = "Re:Request for MyChart Web Access"
em.SendTo = Me.TextBoxEmail.Text
' em.Body = FileToString(ConfigurationManager.AppSettings("DENIAL_EMAIL_LOCATION"))
em.Body = FileToString(HttpContext.Current.Server.MapPath(".") & "\Correspondence\" & "Denied.htm")
If Not SendEmail(em, strerrmsg) Then
Session("Error Message") = "Error sending email " & strerrmsg
Server.Execute("WebformError.aspx")
Else
pr.PatClass.Rejected_Email_Sent = True
End If
End If
If dt.UpdatePatientDetailsInOracle(pr) Then
Session("PatientDetails") = pr.PatClass
'Server.Execute("WebFormDenied.aspx")
Session("EpicRejectReason") = str_message & vbCrLf & "An email has been sent."
Server.Execute("WebFormEpicReject.aspx")
Else
Session("Error Message") = dt.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
Exit Sub
End If
Case 5, 1 ' Valid and unused access code exists (does now even if it did not before).
pr.PatClass.Status = "Approved"
If Not dq.GetEpicPinNo(pr, str_pinno) Then
Session("Error Message") = dq.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
Exit Sub
Else
pr.PatClass.Epic_Act_Code = str_pinno
If dt.CreateApprovalLetter(pr, str_approval_text) Then
pr.PatClass.Approval_Letter_Sent = True
If Not dt.UpdatePatientDetailsInOracle(pr) Then
Session("Error Message") = dt.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
Exit Sub
End If
Response.Buffer = True
Response.Clear()
Response.Write(str_approval_text)
Response.Flush()
Response.End()
Response.Flush()
Exit Sub
Else
Session("Error Message") = dt.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
End If
End If
Case 3 'Denied by Epic
pr.PatClass.Status = "Rejected"
pr.PatClass.Notes = pr.PatClass.Notes & vbCrLf & "Rejected by Epic on " & Now().ToShortDateString & " because " & str_message
Select Case str_message.ToUpper
Case ("Denied: Patient status active").ToUpper
Dim em As New MyChartRegistration.BDL.DOBJ.DataObjects.EmailMessage
em.Subject = "Re:Request for MyChart Web Access"
em.SendTo = Me.TextBoxEmail.Text
' em.Body = FileToString(ConfigurationManager.AppSettings("REJECTED_EMAIL_LOCATION"))
em.Body = FileToString(HttpContext.Current.Server.MapPath(".") & "\Correspondence\" & "REJECTED.HTM")
em.Body = em.Body.Replace("Denied:", String.Empty)
If Not SendEmail(em, strerrmsg) Then
Session("Error Message") = "Error sending email " & strerrmsg
Server.Execute("WebFormError.aspx")
Exit Sub
Else
pr.PatClass.Rejected_Email_Sent = True
If dt.UpdatePatientDetailsInOracle(pr) Then
Session("EpicRejectReason") = str_message & vbCrLf & "An email has been sent."
Server.Execute("WebFormEpicReject.aspx")
Else
Session("Error Message") = dt.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
End If
End If
Case Else ' Epic rejected for some other reason besides an existing account, like not
' meeting minimum age requirement.
Dim em As New MyChartRegistration.BDL.DOBJ.DataObjects.EmailMessage
em.Subject = "Re:Request for MyChart Web Access " & str_message
em.SendTo = Me.TextBoxEmail.Text
' em.Body = FileToString(ConfigurationManager.AppSettings("REJECTED_EMAIL_LOCATION"))
em.Body = FileToString(HttpContext.Current.Server.MapPath(".") & "\Correspondence\" & "REJECTEDOther.HTM")
em.Body = em.Body.Replace("Denied:", String.Empty)
If Not SendEmail(em, strerrmsg) Then
Session("Error Message") = "Error sending email " & strerrmsg
Server.Execute("WebFormError.aspx")
Exit Sub
Else
pr.PatClass.Rejected_Email_Sent = True
If dt.UpdatePatientDetailsInOracle(pr) Then
Session("EpicRejectReason") = str_message & vbCrLf & "An email has been sent."
Server.Execute("WebFormEpicReject.aspx")
Else
Session("Error Message") = dt.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
End If
End If
End Select
End Select
Else
'Epic web service returned an error.
Session("EpicError") = str_message
Server.Execute("WebForEpicError.aspx")
Exit Sub
End If
End Select
Session("PatientDetails") = pr.PatClass
If Not dt.UpdatePatientDetailsInOracle(pr) Then
Session("Error Message") = dt.LastException.MESSAGE
Server.Execute("WebFormError.aspx")
Exit Sub
End If
Catch ex As Exception
If ex.Message.ToUpper <> "THREAD WAS BEING ABORTED." Then
Session("Error Message") = ex.Message
If Not ex.InnerException Is Nothing Then
Session("Error Message") = ex.Message & " " & ex.InnerException.Message
End If
'Response.Redirect("WebFormError.aspx")
Server.Execute("WebFormError.aspx")
End If
End Try
End Sub
Sub ValidateState(ByVal sender As Object, ByVal args As ServerValidateEventArgs)
If args.Value = "NONE" Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub
Public Function SendEmail(ByVal em As MyChartRegistration.BDL.DOBJ.DataObjects.EmailMessage, ByRef strerrmsg As String) As Boolean
Dim retval As Boolean = True
Dim Email As New MailMessage("FromEmail@ochsner.org", em.SendTo)
Dim MySMTPClient As New Net.Mail.SmtpClient(ConfigurationManager.AppSettings("EMAIL_SERVER")) ' Instantiate a new instance of SmtpClient
Try
'create the mail message
'Dim Email As New MailMessage("FromEmail@ochsner.org", em.SendTo)
'Dim MySMTPClient As New Net.Mail.SmtpClient(ConfigurationManager.AppSettings("EMAIL_SERVER")) ' Instantiate a new instance of SmtpClient
Email.Subject = em.Subject
Email.Priority = MailPriority.Normal
Email.IsBodyHtml = True
'Email.Body = "<b>Hello</b><br><br>This is the body of your email"
'Email.Body = em.Body
Email.Body = em.Body
MySMTPClient.UseDefaultCredentials = True
MySMTPClient.Send(Email)
Catch ex As Exception
retval = False
strerrmsg = ex.Message
If Not ex.InnerException Is Nothing Then
strerrmsg = strerrmsg & " " & ex.InnerException.Message
End If
Finally
If Not MySMTPClient Is Nothing Then
MySMTPClient.Dispose()
End If
If Not Email Is Nothing Then
Email.Dispose()
End If
End Try
Return retval
End Function
Protected Sub DropDownListApprove_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles DropDownListApprove.SelectedIndexChanged
If DropDownListApprove.SelectedValue.ToUpper = "DENIED" Then
Me.CheckBoxDenial.Visible = True
Else
Me.CheckBoxDenial.Visible = False
End If
If DropDownListApprove.SelectedValue.ToUpper = "REJECTED" Then
Me.CheckBoxRejected.Visible = True
Else
Me.CheckBoxRejected.Visible = False
End If
If DropDownListApprove.SelectedValue.ToUpper = "APPROVED" Then
Me.CheckBoxApproval.Visible = True
Else
Me.CheckBoxApproval.Visible = False
End If
End Sub
Private Sub DropDownListApprove_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownListApprove.TextChanged
'If DropDownListApprove.SelectedValue.ToUpper = "DENIED" Then
' Me.CheckBoxDenial.Visible = True
'Else
' Me.CheckBoxDenial.Visible = False
'End If
End Sub
Private Sub ButtonSubmit_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonSubmit.Load
End Sub
Protected Sub ButtonReSend_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonReSend.Click
Dim prt As New MyChartRegistration.BDL.DOBJ.InputParameters.PatientInputParms
prt.PatClass = Session("PatientDetails")
Dim stroutput As String
Dim dt As New MyChartRegistration.BDL.MyChartTransactions.BL.DataTransactions
If dt.CreateApprovalLetter(prt, stroutput) Then
Response.Clear()
Response.Write(stroutput)
Response.Flush()
Response.End()
End If
End Sub
End Class
The error seems to go away if you remove the runat=server from the head tag.
Try changing the line <head id="Head1" runat="server">
to
<head id="Head1">
I can't see that it needs to be run on the server as it's not mentioned in the code behind. Try it and see.
Try changing the line <head id="Head1" runat="server">
to
<head id="Head1">
I can't see that it needs to be run on the server as it's not mentioned in the code behind. Try it and see.
ASKER
Tried it. Still getting an error under either approach.
If I choose Ignore when the error occurs the program continues.
Isn't there a way to turn javascript debugging off for the end user?
Not the best solution, but for now at least the page would be usable.
If I choose Ignore when the error occurs the program continues.
Isn't there a way to turn javascript debugging off for the end user?
Not the best solution, but for now at least the page would be usable.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You are right on target Seonyx: From outside VS, just logging in as a user would, the error does not appear to occur with either FireFox or IE (its intranet, so I can be sure the users will be using IE).
THANKS!
THANKS!
Center screen horizontal or vertical? If you mean horizontal, then you need to put a fixed width on your <body> tag and give it a left/right margin of auto in your CSS.