Jump to content
Xtreme .Net Talk

lorena

Avatar/Signature
  • Posts

    134
  • Joined

  • Last visited

Everything posted by lorena

  1. I recently installed Visual Studio 2003 upgrade and made sure that the .net framework on my computer has been upgraded too. Now the .aspx page I am working on is giving me a "System.NullReferenceException: Object reference not set to an instance of an object" error. Here is my code: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim dtmDate As Date dtmDate = DateTime.Now txtReqDate.Text = dtmDate.ToShortDateString success = True added = True End Sub It worked in the previous version of Visual Studio. Any ideas as to why this is happening? I would appreciate any help.
  2. I also tried using the ItemCommand because it seems that the Edit fires as soon as it's clicked showing the "Update" and "Cancel" linkbuttons. So I was hoping to disable the Update but this doesn't work either. Private Sub dgRecs_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgRecs.ItemCommand Select Case (CType(e.CommandSource, LinkButton)).CommandName Case "Update" If e.Item.Cells(8).Text <> "" Then e.Item.Cells(0).Enabled = False End If Case Else ' Do nothing. End Select End Sub
  3. Thanks for the idea. I tried it but the Edit event still fires and I still get the "Update" and "Cancel" Buttons
  4. I tried: e.Item.Cells(0).Controls.Clear (0 is the Edit index) and also tried e.Item.Cells(8).enable = false and then I thought maybe if I just reset the EditItemIndex dgRecs.EditItemIndex = -1 but the Edit Item control (in this case a calendar control) is still visible and clickable. Isn't there some way to just ignore the user request if that particular cell in the row is a date?
  5. I tried setting it to ReadOnly as you suggested but it errors out.
  6. I have a form with a datagrid that loads open and closed records for the users to view. They need to be able to edit records that are not closed but closed records should be read only. Is there a way to do this? I thought I had a handle on it but my coe doesn't work. Here it is: Sub dgRecs_EditRow(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) dgRecs.EditItemIndex = e.Item.ItemIndex If IsDate(e.Item.Cells(8).Text) Then e.Item.Cells(8).Enabled = False End If BindData() End Sub
  7. Thanks! i will check that out
  8. I have a datagrid for a user to edit records. It will load "ALL", "OPEN" or "CLOSED" records depending on a value selected from a dropdown. With "ALL" and "CLOSED" records, any records that are closed are not (or should not) be available for editing. It will depend on whether or not the cell containing the close date has a value. Is there a way to disable a row when a date is present in the "close date" cell? Thanks in advance.
  9. Thanks, I will try that out! I appreciate your help
  10. I have a form with a datagrid and when the user clicks on a row to edit it, a calendar control is visible to enable the user to enter a complete date. So far, entering the complete date works great but if a complete date is not chosed (it is not required), how do I handle that?
  11. Thanks! I will give that a try. I really appreciate it.
  12. I have a form with a datagrid from which the user can edit and delete records. Since one of the fields is a date field. I would like to include a calendar control as part of the edit in addition to the usual textboxes Is there an example of this somewhere? Thanks
  13. Thanks! Man, I looked and looked at that code and it blew right by me :)
  14. I have a form which uses (or tries to use) two separate calendar controls. The user needs to be able to select different dates for 2 different locations. My problem is that the calendar events are some how interrelated and I have to click several times to the the selection in the second calendar to display (I have the controls set up to write the selected dates to associated textboxes). Is it not possible to use two calendar controls? If it is possible, how do I separate the events. Here is my code: (Both controls use this event to prevent users from selecting a date that is in the past) Sub DayRender(ByVal source As Object, ByVal e As DayRenderEventArgs) If e.Day.Date < Now.Date Then e.Day.IsSelectable = False End If End Sub Private Sub calP1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles calP1.SelectionChanged txtP1_Date.Text = calP1.SelectedDate End Sub Private Sub calP3_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles calP1.SelectionChanged txtP3_Date.Text = calP3.SelectedDate End Sub
  15. IT WORKS!!!!! You are right, it must be some wierd thing with the parser but as soon as I set it up the way you suggested, it works fine. Thank you so very much!!
  16. Thanks for the idea. I tried it and I am still getting the same error
  17. I have an asp.net form that adds a record to a table and then increments a counter variable in another table before closing the connection. The add record part works fine but I am getting "Syntax error in UPDATE statement" when I try to update the incremented field in the counter table. (I started trying to do the operation as an INSERTbut that didn't work either) Here is my code: strSQL = "Update NumberGen set Counter = ~ where ID like 'SK'" strSQL = Replace(strSQL, "~", intCounter) objCommand = New OleDb.OleDbCommand(strSQL, objConn) objCommand.ExecuteNonQuery() objConn.Close() I have tried substituting an actual number in place of intCounter (didn't work) and also tried running it against the access database with an actual number in place of the variable (worked fine). Any help would be appreciated. Thanks
  18. Doh! I looked at that code and looked at it and didn't see the "." Thanks!!
  19. I keep getting this error: "Number of query values and destination fields are not the same" I have exactly the same number of fields in my query that are in the database and they are in the same order. I even went so far as to take the parameter values out and substitute hard-coded values and it still throws up. I am not sure what I am doing wrong. Do I have to have a Primary Key for this to work? All this app does is record form data to be exported to a spreadsheet. Here is my code: Sub AddRecord() Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\intranet\databases\results.mdb" Dim strSQL, strPlant, strTire, strFilter, strWiper As String Dim objCommand As OleDb.OleDbCommand Dim objConn As New OleDb.OleDbConnection(strConnString) 'Create SQL String strSQL = "Insert into PML(Customer, PhoneNo, PlantNo, CarYear, CarMake, CarModel, " strSQL = strSQL + " DropOff, NeededBy, AirFilter, WiperBlades, Rotation) VALUES " strSQL = strSQL + " ('Ethel Mertz', '555-5555', '1', 'Toyota', 'Corolla', '2001', " strSQL = strSQL + " '730'. '430', 'Y', 'N', 'Y')" objCommand = New OleDb.OleDbCommand(strSQL, objConn) objConn.Open() objCommand.ExecuteNonQuery() objConn.Close() End Sub Any help would be appreciated. Thanks
  20. Thanks. CSV sounds like it might work
  21. I have a form that I need to have post to an Excel spreadsheet.Is this possible? I have examples that read from a spreadsheet but can't find info on posting to a spreadasheet. Any help is appreciated
  22. Sorry - I understand now. I fixed the code and it works. Thanks!
  23. Are you saying if I handle an event in the code behind I don't need to reference it or call it from the front (aspx) page?
  24. I have been working on an aspx page in local mode and it works fine on my p.c. but when I copy the pages out to the web server, I get an error. The code counts the number of items selected in a checkboxlist and writes the number as an integer to a textbox. Here is the error I get: "BC30456: 'SystemApp_OnSelectedIndexChanged' is not a member of 'ASP.p_supp_aspx'" Here is the code associated with the checkbox list: (From the aspx page - there are 4 checkboxes associated with this list) <asp:checkboxlist id="SystemApp" Runat="server" AutoPostBack="True" RepeatColumns="4" RepeatDirection="Horizontal" OnSelectedIndexChanged="SystemApp_OnSelectedIndexChanged"> (From the code behind page) Sub SystemApp_OnSelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _ SystemApp.SelectedIndexChanged Dim itmApp As ListItem ViewState("TotApp") = 0 For Each itmApp In SystemApp.Items If itmApp.Selected = True Then ViewState("TotApp") += 1 End If Next TotSysApp.Text = ViewState("TotApp") + ViewState("TotOthApp") End Sub
  25. I think I found my problem. I had to move the "Dim objCommand" line to be run after the connection is open
×
×
  • Create New...