Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Member 8408064

@Member 8408064
About
Posts
3
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Modify webpage controls in a contentplaceholder from a class.vb file
    M Member 8408064

    This problem has been resolved (with a lot of help from my friends) and I thought it would be worth while to post the solution to help any others who might be interested. It only took two relatively minor changes to make the code work. Here they are: Original Procedure declaration Public Sub SetControls(ByVal Controltype As String, ByVal StartCtrl As Integer, ByVal StopCtrl As Integer, ByVal SetValue As Boolean) Original call to procedure objMiscUtilities.SetControls("TextBox", 2, 20, False) Corrected Procedure declaration Public Sub SetControls(ByVal Controltype As String, ByVal StartCtrl As Integer, ByVal StopCtrl As Integer, ByVal SetValue As Boolean, ByVal objPlaceHolder As ContentPlaceHolder) Corrected call to procedure objMiscUtilities.SetControls("TextBox", 2, 20, False, Master.FindControl("rightcolumn")) Ron Brewer

    ASP.NET help csharp asp-net json

  • Modify webpage controls in a contentplaceholder from a class.vb file
    M Member 8408064

    I tried your example and got a "rightcolumn not declared" error. If this is not what you meant tell me what I should use instead of the id of the contentplace holder and I will try that. I've seen some posts on the web indicating that I should be using "Master.FindControl" to get to the contentplaceholder where the controls are, but then I get a "Master not declared" error. That code works in the aspx.vb page, but not in the class.vb. I'm sure this has been attempted before, but so far my web surfing hasn't turned up any examples. It seems using a master page with contentplaceholders severely limits what you can do in a class file. Anyway, thank you for your interest and input. Ron Brewer

    ASP.NET help csharp asp-net json

  • Modify webpage controls in a contentplaceholder from a class.vb file
    M Member 8408064

    I'm using VB.NET and ASP.NET in VS2005 to create a web application that has some very similar code in five different webpages. This code enables/disables various controls depending on the actions allowed in the current page. I would like to consolidate this code into a subroutine in a class.vb file and call it from the aspx.vb files. I’m using a Master Page with four contentpageholders. Only one has the controls in question, but herein lies my problem. I can access the controls on webpages not using the Master Page, but can’t make the code work with the contentpageholder. Here is the code in the class file: Public Sub SetControls(ByVal Controltype As String, ByVal StartCtrl As Integer, ByVal StopCtrl As Integer, ByVal SetValue As Boolean) Dim myPage As Page Dim intIndex As Integer Dim objPlaceHolder As ContentPlaceHolder myPage = TryCast(HttpContext.Current.Handler, Page) objPlaceHolder = TryCast(myPage.FindControl ("rightcolumn"), ContentPlaceHolder) **** If Not objPlaceHolder Is Nothing Then **** “Nothing” Select Case Controltype Case "TextBox" Dim txtTextBox As TextBox For intIndex = StartCtrl To StopCtrl txtTextBox = TryCast (myPage.FindControl("TextBox" & intIndex), TextBox) If Not txtTextBox Is Nothing Then txtTextBox.ReadOnly = SetValue Else Exit For End If Next End Select End If End Sub End Class And I call the procedure like this: Sub LockControls() Dim objMiscUtilities As New MiscUtilities objMiscUtilities.SetControls("TextBox", 2, 20, False) End Sub Whenever I test the program the “objPlaceHolder” is always nothing, so the rest of the code is bypassed. Any help will be greatly appreciated. Ron Brewer

    ASP.NET help csharp asp-net json
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups