
Jackpanel
Avatar/Signature-
Posts
35 -
Joined
-
Last visited
Jackpanel's Achievements
Newbie (1/14)
0
Reputation
-
If your textbox is blank, you're going to get an error with this line: select case GrandTotalUSDValue.text > 250000 Its trying to compare "" to 250000 - hence the Cannot Convert "" to Double error. You need to first make sure there is a number in the Grand Total box before checking to see whether its higher than 250000. Try wrapping the Select statement in a : If IsNumeric(GrandTotalUSDValue.text) Then Select Case GrandTotalUSDValue.text > 250000 case true 'GrandTotalUSDValue.cssclass="ColorUp" ' other processing if necessary End Select End If
-
Cast from string "" to type 'Double' is not valid Looks like GrandTotalUSDValue.text is blank. It needs to be a double for your Select Case comparison
-
<img src="<%=image_path%>new_client/ci-top_01.gif" > ?
Jackpanel replied to utilitaire's topic in ASP.NET
1) yeah, it would be a heavy way of handling it. Depends on your application whether or not this is reasonable. 2) You should be able to figure out in advance all the possible controls and expand the If-Else to handle each. You can share this sub with all pages in your app, so you'd only have to do it once. 3) The replace function is looking for ~, so shouldn't affect any external links. Another option would be to set the page base in the header: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="test.aspx.vb" Inherits="test"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>test</title> <asp:literal id="litSetBase" runat="server"></asp:literal> </HEAD> <body> <form id="Form1" method="post" runat="server"> <img src="choose.gif"> </form> </body> </HTML> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load litSetBase.Text = "<BASE href='http://localhost/FR/'>" End Sub However, this will also affect any relative links you may have used in your pages. -
<img src="<%=image_path%>new_client/ci-top_01.gif" > ?
Jackpanel replied to utilitaire's topic in ASP.NET
Care to explain? -
<img src="<%=image_path%>new_client/ci-top_01.gif" > ?
Jackpanel replied to utilitaire's topic in ASP.NET
Probably your best solution would be to loop through all image controls and adjust the ImageURL property to the right folder. Here's an example, where I'm setting the folder to pick from using the sLanguage variable. I go through all controls in the page, and if its an image, replace the "~" in the image path with a "~/FR". This requires your images all have the url set to "~/imagename.gif" style, but you can adjust it if you have a different setup: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sLanguage As String = "FR" SetImagePath(Page, sLanguage) End Sub Private Sub SetImagePath(ByVal p_Control As Control, ByVal p_Language As String) Dim ctrl As Control For Each ctrl In p_Control.Controls If TypeOf ctrl Is System.Web.UI.WebControls.Image Then Dim sNewPath As String sNewPath = CType(ctrl, System.Web.UI.WebControls.Image).ImageUrl.Replace("~", "~/" & p_Language) CType(ctrl, System.Web.UI.WebControls.Image).ImageUrl = sNewPath Else If ctrl.Controls.Count > 0 Then SetImagePath(ctrl, p_Language) End If End If Next End Sub -
<img src="<%=image_path%>new_client/ci-top_01.gif" > ?
Jackpanel replied to utilitaire's topic in ASP.NET
<%="<img src='" & image_path & "img1.gif'>" %> -
At some point when working on my database model in Visio (for Enterprise Architects - 2002), I must have deleted an unconnected relationship but didn't remove it from the underlying model. Now when I error check it, I get an error 2100 saying '_FK1' : Relationship is not fully connected. Since the relationship isn't on any of the diagrams, I can't figure out any way to access it to delete it from the underlying model. There doesn't seem to be any way to browse the relationships in the model, and it will even allow me to add and delete a new relationship named _FK1 without fixing the problem. Does anyone know a way to access/delete this relationship in Visio?
-
I've got two different ways that I've done templates. First is similar to ASP includes, and the second is using inheritence. For the first method, I created a custom control with all my navigation elementals. Depending on the user's level, I fill the wrapper with different items, like recent edits, admin links, etc. Then on every page, I just registered the wrapper control, and every page had a span called Main-Body which I positioned with CSS to allow room for the side and header to wrap around it. This worked well, but there was a lot of repetitive code. Now I've started using inheritence to create page templates. It took me a bit of playing around to get working, but now that I have it set up, its a breeze. I created a PageBase class (PageBase.vb) that adds all the header and footer template information, including Body tags and Form tags, then loads the controls from the content page as it gets built (myForm). I built my previous wrapper control into it (myWrapper control), but you could just as easily create the wrapper items within the PageBase class itself. Imports System Imports System.Web Imports System.Web.UI Imports System.Web.UI.HtmlControls Imports System.Web.UI.WebControls Public Class PageBase Inherits System.Web.UI.Page Private myForm As HtmlForm Private myWrapper as Wrapper Protected Overrides Sub OnInit(ByVal e As System.EventArgs) BuildPage() MyBase.OnInit(e) End Sub Protected Sub BuildPage() Dim newPlaceHolder As PlaceHolder Dim iCurrControlNum As Integer = 0 Dim i as Integer myForm = New HtmlForm myForm.ID = "objForm" 'Wrapper myForm.Controls.Add(New LiteralControl("<span class='noprint'>")) iCurrControlNum += 1 myForm.Controls.Addat(iCurrControlNum, LoadControl("~/Resource/Global/Wrapper.ascx")) iCurrControlNum += 1 myForm.Controls.Add(New LiteralControl("</span>")) iCurrControlNum += 1 'Pull Content from the requested page myForm.Controls.Add(New LiteralControl("<span class='main-body'>")) iCurrControlNum += 1 For i = 0 To Me.Controls.Count - 1 myForm.Controls.AddAt(iCurrControlNum, Me.Controls(0)) iCurrControlNum += 1 Next myForm.Controls.Add(New LiteralControl("</span>")) iCurrControlNum += 1 Me.Controls.Clear() 'HEADER Me.Controls.Add(New LiteralControl( _ "<html> " & vbCrLf & _ " <body ID='PageBody'>" & vbCrLf)) 'CONTENT FORM Me.Controls.Add(myForm) 'FOOTER Me.Controls.Add(New LiteralControl( _ " </body>" & vbCrLf & _ "</HTML>")) End Sub End Class Now, creating a new page using the template is a snap. All I have to do is make each page inherit the PageBase class instead of System.Web.UI.Page, and it automatically applies the template. The content page needs only the content itself, no form tags, no body tags, no headers.
-
Thanks for the suggestion. I had actually done that at one point in the past, but was getting frustrated developing, because everytime I'd compile the project, the session variables would be cleared but not the formsauthentication variables. I guess it won't be a big issue on the production system, but it would be nice if I could solve the problem to save me some hassles as I develop and test.
-
I'm having a small problem with forcing users to login when either their FormsAuthentication is no longer valid, or when the session variables expire. My problem is that if the Session expires, but the FormsAuthentication passes, the page tries to load. Since I keep track of user account IDs (different from the UserID, which I can store in User.Identity.Name) in a session variable, this causes a lot of SQL queries to come back empty. e.g. "SELECT * FROM Orders WHERE AccountID = " & Session("AccountID") I've tried forcing a FormsAuthentication signout and page reload whenever a new session is started, but it doesn't actually force a login unless I reload the page Sub Session_Start(Sender As Object, E As EventArgs) if request.IsAuthenticated then FormsAuthentication.SignOut() Session.abandon ' reload page Response.Redirect(sReloadURL) end if I'd rather not have to put code to check for session variables into each and every page, and figure there must be an efficient way to handle this in the global.asax file. Another option would be to stop using Session variables completely if there is a better way to store these kinds of variables tied directly to the FormsAuthentication. I'm using roles-based authentication, but that doesn't quite cover all the variables I need for each user. Suggestions?
-
Solved I finally figured it out. If anyone is interested, I used 3 DIVs to produce the effect: <div style='OVERFLOW: auto; WIDTH: 614px; HEIGHT: 101px'> <div style='OVERFLOW: hidden; WIDTH: 598px;'> <div style='OVERFLOW: visible; WIDTH: 614px; HEIGHT: 101px'> Innermost DIV allows the table to go as wide as it takes. Middle DIV chops the table off at with overall table width minus the scroolbar, then the outermost DIV has full scroll bars allowed, but only needs it for vertical. It would have been much easier if the Overflow property allowed for vertical and horizontal only :mad:
-
I'm working on a app that helps build quotes and invoices. On one of the pages, I have a datagrid to display a table of all items that have been added so far. To help control the layout, I put this datagrid in a scrolling DIV, so that a maximum of 5 items are displayed, and a vertical scroll bar appears. This is working great, except under one condition - if a description is entered that is too long for the table cell. Because of the way I have it formatted, I can't have cells wrap their contents, and I can't have a horizontal scroll bar. What I need to do is either truncate strings that take up too much space, or figure out a way to strictly enforce the table width no matter how large the contents. I've got a sample of the output here: http://www3.sympatico.ca/jasongraham/divscroll.html View source to see how each is set up. The third one is closest to what I need, but the right scrollbar is being cut off. Any suggestions on how I can handle this? I'd truncate the description strings, but comparing character counts won't work because I'm not using a font with fixed character widths (i.e. "iiiiiiiiii" takes up much less space than "OOOOOOOOOO")
-
Oops, I forgot to update the application root. It was pointing to a local javascript. It should be fixed now. Doing a bit more investigating, the problem seems to be that the literal is storing the javascript command to hide the window whenever the Accept or Cancel buttons are used. I could partially fix it by resetting the literal to a blank script in the Calendar1_SelectionChanged section, but it wasn't triggering when a user was changing months. What I need to do is clear out the literal every time it fires so that it doesn't fire again the next time the form is submitted. I'm just not sure where exactly I can do this.
-
I'm working on a pop-up calendar control that will eventually open up in a centered layer. The goal is to make it similar to a modal window, but all in one browser window instead of opening the calendar in a new popup window. I have a read-only textbox with a little calendar icon next to it, which makes the calendar DIV visible when clicked. The user then selects their date, presses Accept and it hides the DIV and fills the textbox. This works perfectly the first time a user tries it. My problem is that if the user opens the calendar again, then no matter what the click on, it it triggering the btnAccept_click or btnCancel_click events and closing the DIV without updating the textbox. It won't allow the user to change months, because it closes as soon as the NextMonth button is pressed. You can view the sample here: http://edtweb01dev411.edthosting.com/om/member/test.aspx Use Test as both the email and login to access the page. Click the calendar, pick a date, then choose accept. Works fine, right? Now try it again without reloading and see the problem. Code is as follows: Test.aspx <%@Register tagprefix="OM" Tagname="calendar" src="~/Resource/TestCalendar.ascx" %> <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TEST.aspx.vb" Inherits="TEST"%> <%= "<script language='JavaScript' src='" & Application("Root") & "/Resource/Global/common.js'></script>" %> <%= "<link href='" & Application("Root") & "/Resource/style1.css' type='text/css' rel='stylesheet'>" %> <%= "<link href='" & Application("Root") & "/Resource/style1-print.css' type='text/css' rel='stylesheet'>" %> <script> function init(){ divCalendar.style.left = CenterLeft - 70 divCalendar.style.top = CenterTop - 150 } </script> <body onload="init()"> <form id="OpportunityForm" method="post" runat="server"> <asp:textbox id="lblSubmissionDue" runat="server" ReadOnly="true" type="text" cssclass="details-alt1-input"></asp:textbox> <IMG alt="" src="../images/calendar.gif" onclick="javascript:show('divCalendar')"> <div id="divCalendar" class="calendar"><OM:calendar runat="server" id="objCalendar"/></div> </form> </body> Test.aspx.vb Public Class TEST Inherits System.Web.UI.Page Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class TestCalendar.aspx <%@ Control Language="vb" AutoEventWireup="false" Codebehind="TESTCalendar.ascx.vb" Inherits="TESTCalendar" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %> <asp:panel id="pnlCalendar" runat="server"> <TABLE borderColor="black" cellSpacing="0" cellPadding="0" border="1"> <TR> <TD> <TABLE borderColor="white" cellSpacing="0" cellPadding="0" border="5"> <TR> <TD> <asp:Calendar id="Calendar1" runat="server" PrevMonthText="<<" NextMonthText=">>" Width="200px" Height="150px" BorderColor="Black" BackColor="#EFEFE0" OnSelectionChanged="Calendar1_SelectionChanged" Font-Names="Arial" Font-Size="X-Small"> <SelectorStyle font-bold="True" forecolor="Navy" backcolor="Navy"></SelectorStyle> <NextPrevStyle forecolor="White" backcolor="#293473"></NextPrevStyle> <DayHeaderStyle font-bold="True"></DayHeaderStyle> <SelectedDayStyle font-bold="True" forecolor="White" backcolor="#293473"></SelectedDayStyle> <TitleStyle font-bold="True" forecolor="White" backcolor="#293473"></TitleStyle> <OtherMonthDayStyle font-italic="True" backcolor="#BFC5E1"></OtherMonthDayStyle> </asp:Calendar> <asp:ImageButton id="imgAccept" runat="server" ImageUrl="~/images/accept.gif"></asp:ImageButton> <asp:ImageButton id="imgCancel" runat="server" ImageUrl="~/images/cancel.gif"></asp:ImageButton> <asp:literal id="Literal1" runat="server"></asp:literal></TD> </TR> </TABLE> </TD> </TR> </TABLE> </asp:panel> TestCalendar.aspx.vb Public MustInherit Class TESTCalendar Inherits System.Web.UI.UserControl Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar Protected WithEvents imgAccept As System.Web.UI.WebControls.ImageButton Protected WithEvents imgCancel As System.Web.UI.WebControls.ImageButton Protected WithEvents pnlCalendar As System.Web.UI.WebControls.Panel Protected WithEvents Literal1 As System.Web.UI.WebControls.Literal Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Public Sub Calendar1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) If e.Day.Date = DateTime.Now().ToString("d") Then e.Cell.BackColor = System.Drawing.Color.LightGray End If End Sub Private Sub imgAccept_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgAccept.Click Dim strjscript As String = "<script language=""javascript"">" strjscript = strjscript & "OpportunityForm.lblSubmissionDue.value='" & Format$(Calendar1.SelectedDate, "MMMM d, yyyy") & "';hide('divCalendar')" strjscript = strjscript & "</script" & ">" Literal1.Text = strjscript End Sub Private Sub imgCancel_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgCancel.Click Dim strjscript As String = "<script language=""javascript"">" strjscript = strjscript & "hide('divCalendar')" strjscript = strjscript & "</script" & ">" Literal1.Text = strjscript End Sub End Class