.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

reference web control from shared sub

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net


Guys I need reference a Treeview from a shared sub so I can run a databind on it after the the sub has finished doing it's thing.

Any Ideas?

View Complete Post

More Related Resource Links

Problems with a .NET4 Control GAC Reference failing at runtime but fine during debugging

I believe this question is specific to the CLR how ever I will test this in a Forms Application later. I have multiple .Net 4 Targeted WPF Applications that Reference Non Microsoft .NET 4 WPF Controls that I can confirm are in the GAC. Everything Debugs Great (Noting that none of the references are copied to the output directory) and Install's well using a Setup Package and manually installing has the same effect even after a reboot. The problem is the application will not start even as an administrator as it does not find the Control References in the GAC. This also happens if I try to start the application manually in the visual studio output Directory. I can also confirm that opening the application in reflector that reflector is able to correctly find the references. Finally if I copy the controls (.dll's) to the location of the application everything runs as expected for all the above issues.   My question here is why is my application not able to load the .NET 4 controls from the GAC? Also note that everything uses a Strong Name.

WPF Ribbon Control binding to a VM Ribbon reference

Hi, I have a scenario where I will initialize the Ribbon in XAML but its relatd Tab, group, buttons etc., needs to be coming from VM file , meaning there will be a public property of Ribbon which needs to be set back to the Ribbon that was initialized in XAML like ( I am using WPF provided Ribbon control only)  <r:Ribbon Height="135" VerticalAlignment="Top" Name="mainRibbon" ... > // Above XAML I need to set the RibbonControl which is a public property (having the tabs, gropping, buttons etc., // Since WPF ribbion doesn't have ItemsSource I am struggling to set this ... In the VM file private Ribbon _RibbonControl; public Ribbon RibbonControl { get {      CreateRibbon() //This functon will creates tabs, groups, buttons etc., & adds to _RibbonControl      return _RibbonControl; } } Any help here is greatly appreciated. Prakash.G

Full Control users only able to edit Shared Version of page in MOSS 2007

Hi, In MOSS 2007 we have a site collection that does not allow the owners to edit pages. There is no broken inheritance in the permissions, and when a user clicks "Site Actions" and then "Edit" they get a toolbar saying they are only editing the Shared Version of the page. No pages are checked out to any other users either and the users attempting this (including the Farm account) are not able to edit these pages. What would be the next steps to debugging this problem as it is not one I have encountered previously?  

How to reference a elements of one control from other


Can someone explain how user controls can communicate with each other within an asp.net application. I am facing many obstacles at the moment regarding this problem. For example, is it possible to set the visible property of a panel on one user control based on what happens in another?

Another example would be: Can I set the text of a label in one control to be the value of some other property from another control's class like.... Me.PreContentColumn.ColumnID = LocalProduct.PreContentColumnId.

Please let me know if this sounds confusing...

Object Reference Error While Rendering Menu Control


I am having a problem with rendering a menu control inside a server control. I am getting an error in the RenderContents override method when I try to render the Menu Control. The error I am getting is an Object Reference error. The code is below...

[ToolboxData("<{0}:Login runat=server></{0}:Login>")]
    public class Login : CompositeControl
        #region Members

        Label tst;
        Menu loginMenu;
        MenuItem mainLoginItem;
        MenuItem loginItem;
        MenuItem usernameItem;
        MenuItem passwordItem;
        SubMenuStyle subMnuStyleControl;
        SubMenuStyle subMnuStyleMenu;

        bool isLoggedIn = false;


        #region Properties

        public bool IsLoggedIn
            get { return isLoggedIn; }

            set { isLoggedIn = value; }


        #region Overridden Events

        protected override void RenderContents(HtmlTextWriter writer)



        protected override void OnInit(EventArgs e)

            #region Add CSS references
            string cssUrl = Page.ClientScript.GetWebResourceUrl(this.Ge

Can not reference text value in footer of Gridview control


I have been struggling with this all week end .... Yell

I am trying to implement adding a new record using the Gridview footer.

I have an example that works finethat I got from http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx.

My situation is a little different .. as I am using master page and the Gridview is in a page derived from the master page.

I have tried:

Dim txtNewName As TextBox = DirectCast(GridView1.FooterRow.FindControl("NewName"), TextBox)

"NewName" is the ID of the textbox in the footer of the Gridview.

When I try referencing ... txtNewName.Text ... it returns a null value.

There must be some trick to referencing this .Text value when using the Gridview that is within a Content Place Holder that results when using a page that was created using a master page.


Thanks in advance fo any possible help with this problem ...

Object reference not set to an instance of an object in Nested Repeater Control of CheckBox List con

 if ((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem))
                Repeater rptsub = (Repeater)item.FindControl("rptsub");
                CheckBoxList Chksub = (CheckBoxList)rptsub.FindControl("Chksub");
                Label lblsubroot = (Label)rptsub.FindControl("lblsubroot");
                DataRowView row = (DataRowView)e.Item.DataItem;
                RootId = Convert.ToInt32(row["IdApplication"].ToString());
                MetadataPermissions metadataPermissions = new MetadataPermissions(); ;
                DataSet rptRootValues = new DataSet();
                rptRootValues = metadataPermissions.GetrptSubMenus(RootId);
                DataRow[] drows = rptRootValues.Tables[0].Select("IdApplicationroot = " + row["IdApplication"].ToString());
                foreach (DataRow chkpermsns in drows)
                   ListItem li = new ListItem(chkpermsns["PermissionName"].ToString());


<asp:Repeater ID="rptroot" runat="server" OnItemDataBound="rptroot_ItemDataBound">

Use a WPF control in a Public Shared function



I am trying to write a program that uses a button on one window to alter a control in another window.  I have a Public Shared Sub declaration in the window I wish to alter, but I cannot put in the code to make the changes to the control (error is "Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class").  How can I get around this so I can change a control's properties from within a Public Shared function?


The Reference for the Shared Dataset is not Valid.


I am running SQL Server 2008 R2 Enterprise 64bit and Reporting Services on  Windows 7 Pro 64 bit. The Report Server is running in Native mode. I have been able to deploy my first report (after running BIDS as administrator), but I cannot render the report from the Report Manager.

When I click on the report in the Report Manager, I get the following message: "

  • The report server cannot process the report. The reference for the shared dataset 'DataSet1' is not valid. (rsInvalidDataSetReference) ".
  • DataSet1 is a Shared Dataset.
  • What am I doing wrong?

  • Reference to a non-shared member requires an object reference in code generated by ASP.NET



    I am working on converting a project from C# to VB and am facing this weird issue. 1 page cannot compile and I get the reference error, but the weird thing is that the compiler shows the error as coming from ASP.NET generated code. Visual Studio shows me that error is coming from my ASPX page. I cannot seem to figure out why or where this error is occuring. Also if I take the inherits attribute out I don't get the compilation error. The code in aspx page is below:

    <%@ Page Language="VB" AutoEventWireup="true" CodeBehind="diff.view.aspx.vb"  Inherits="MR.ControlApp.diffview" MasterPageFile="~/Site1.Master"%>
    <asp:Content ID="Header1" ContentPlaceHolderID="head" runat="server">
        Page: <select onchange="sel(this);">
            Dim j As Integer = 0
            While j < pageCount
               <option <%= IIf(currentPage = ( j + 1 ), "selected", "")  %> value="<%= j+1 %>"><%= j + 1 %></option>
            <%j = j + 1
            End While
        <% 'Print(); %>
        <div style="font-family: verdana; font-size: 10pt; font-weight: bold">
            MDM Data Inconsiste

    Shared Dataset embedded URL reference


    When you add a shared dataset, Report builder puts the fully qualified url reference of that dataset in the RDL.  I would have expected a relative reference, but the server name is embedded in the RDL!  It looks like this:


    When I deploy to another server, that url still points to the old server.  If I set them all to localh

    Reference to a non-shared member requires an object reference


    This is detaining me from transferring my website to another webserver.  So much for a seamless transfer. I had no problem ever with the following line on several pages on my site:

      <%Dim cust As New BusinessLogic.SiteUser(CInt(BusinessLogic.SiteUser.CurrUserID))%>

    This line is used on 4 other pages just like above. The vs 2008 is whining with this error message.

    I opend my 2005 vb.net site into VS 2008 and it asked me if I wanted to upgrade for .net 3.5 and I said yes. I cannot debug and I get the mentioned error. Visual Studio 2005 gives NO such error. What is the issue?  How can I resolve this?

    What is a non-shared member? I don't think I should have to change anything in my business logic area. Can this line, which does 2 things, be done in the code behind? Or partly in the code behind so as to not give this error?

    <%@ Page Language="VB"  AutoEventWireup="false" CodeFile="paypal_featured.aspx.vb" Inherits="paypal_paypal_featured" title="Untitled Page" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <form action="<%=paypalurl%&g

    Reference to a non-shared member requires an object reference


    I do not receive this error when I open my website application in vs 2005. When I open in vs 2008, I get this error. What gives?

    These lines are underlined in blue:

    <%Dim cust As New BusinessLogic.SiteUser(CInt(BusinessLogic.SiteUser.CurrUserID))%>

    Businesslogic area is imported into each of 3 pages with this line. 

    UpdatePanel Reference in control.ascx.designer.cs keeps changing


    I have an annoying problem when I'm developing in Visual Studio 2010. I am using an UpdatePanel in my .ascx file like this:

    <asp:updatepanel id="upStuff" runat="server">....</asp:updatepanel>

    in my control.ascx.designer.cs, the update panel is being defined like this:

    protected global::System.Web.UI.WebControls.WebParts.updatepanel upSettings;

    this produces the error:

    "The type or namespace name 'updatepanel' does not exist in the namespace 'System.Web.UI.WebControls.WebParts' (are you missing an assembly reference?)"

    The actual namespace should be System.Web.UI.UpdatePanel. When I go directly into the designer.cs file and change it, it works. However, every time I go back into editing control.ascx and save, Visual Studio always changes it back to System.Web.UI.WebControls.Webparts.updatepanel.

    I'm not sure what is causing this. Is it how I should be referencing namespaces and classes in my project? I'm using .NET 3.5. Any help would be greatly appreciated.

    Reference control inside an iframe


    I am trying to reference a control inside a iframe. This should be very simple, but I am constantly getting an error. Either object does not exist or undefined. Then I tried to get a reference to all the objects inside a iframe, but I am getting the same kind of error.

    FInally I used
    var test = document.frames("framename").document.all;

    It returns 0, but iframe contains couple of controls...

    Any tips?

    Can't reference Control in Code Behind?


    Hey guys,

    I've got a very odd issue.

    I'm getting an "Object Reference Not Set to an Instance Of An Object Error" in a Web User Control that I've created when referencing any control in the Code Behind. Intellisense reports that the control exists in the aspx, but whenever I build and run I get that error.

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim ImageURL As String = "~/Assets/IMG/"
            Select Case StatusType
                Case "Done"
                    ImageURL += "Indicator_Done.png"
                    panTaskItem.CssClass = "TaskItem-Green"
                Case "NotDone"
                    ImageURL += "Indicator_NotDone.png"
                    panTaskItem.CssClass = "TaskItem-Neutral"
                Case "Warning"
                    ImageURL += "Indicator_Warning.png"
                    panTaskItem.CssClass = "TaskItem-Yellow"
            End Select
            imgIndicator.ImageUrl = ImageURL
            lblTaskTitle.Text = TaskTitle
            lblTaskDescription.Text = TaskDescription
        End Sub

    <asp:Panel ID="panTaskItem" runat="server" Width="100%">
        <div style="flo

    Reference to a non-shared member requires an object reference.


    I cannot seem to find the answer to this error.  I have read all the posts I could find but nada seem to work.


    Here's what I have


    Sub Page_Load

    Dim clsTest As New clsTest

         Dim myTest As String = clsTest.Test1()    <-- Error Reference to non-shared member requires an object reference

     End sub


    Imports System
    Imports Microsoft.VisualBasic
    Imports System.DateTime
    Imports System.Data
    Imports System.Data.SqlTypes
    Imports System.Data.SqlClient
    Imports System.Data.Linq.DataContext

    Imports System.Web
    Imports System.Web.UI.Page
    Imports System.Web.HttpRequest
    Imports System.Collections

    Public Class clsTest

       Public Shared Function Test1() As String

          Return "Test1"

       End Function

    End Class



    Thanks for your help







    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend