Hi all,

I'm stumped...everything on my page is happening twice. Every method is getting called twice. Any idea why something like this would happen?

Markup of page:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MatchActivitiesToReqs.aspx.vb" Inherits="ScoutingWithTheMouse.WebBrowser.Admin_MatchActivitiesToReqs" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Web.Design" Namespace="Telerik.Web.Design" TagPrefix="telerik" %>

<!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 runat="server">
    <title>Admin - Link Activities to Requirements</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    <telerik:RadScriptManager ID="rsmPage" runat="server"></telerik:RadScriptManager>
    
        <telerik:RadComboBox ID="rcbOrgs" runat="server" DataValueField="ID" DataTextField="OrgName" EnableViewState="true" OnSelectedIndexChanged="rcbOrgs_SelectedIndexChanged" AutoPostBack="true" EmptyMessage="Select an organization"/>
        <telerik:RadComboBox ID="rcbLevels" runat="server" DataValueField="ID" DataTextField="Description" OnSelectedIndexChanged="rcbLevels_SelectedIndexChanged" AutoPostBack="true" EmptyMessage="Select a level"/>
        <telerik:RadComboBox ID="rcbReqs" runat="server" datavaluefield="ID" DataTextField="SectionDesc" EmptyMessage="Select a requirement" DropDownWidth="300px" OnSelectedIndexChanged="rcbReqs_SelectedIndexChanged" AutoPostBack="true"/>
        <br />
        <asp:Label ID="lblReq" runat="server" Text="" />
        <br />
        Show: <asp:RadioButton ID="rbLinked" runat="server" text="Linked"/>
              <asp:RadioButton ID="rbUnlinked" runat="server" Text="Unlinked" />
        <asp:Button ID="btnShowActivities" runat="server" Text="Show" />
        
        <telerik:RadGrid ID="rgLinked" runat="server" OnNeedDataSource="rgLinked_NeedDataSource"
         AutoGenerateColumns="false" OnDeleteCommand="UnlinkActivity">
        <MasterTableView DataKeyNames="ID">
            <Columns>
                <telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" CommandName="Delete" />
                <telerik:GridBoundColumn UniqueName="Activity" DataField="activity" />
                <telerik:GridBoundColumn UniqueName="description" DataField="description" />
                <telerik:GridBoundColumn UniqueName="notes" DataField="notes" />
                <telerik:gridboundcolumn uniquename="LocationName" DataField="locationname" />
                <telerik:GridBoundColumn uniquename="LocationTypeDesc" datafield="LocTypeDesc" />
                <telerik:GridBoundColumn UniqueName="LocTypeNotes" DataField="LocTypeNotes" />
                <telerik:GridBoundColumn UniqueName="R2ANotes" DataField="R2ANotes" />
            </Columns>
        </MasterTableView>
        
        </telerik:RadGrid>
        
    </div>
    </form>
</body>
</html>

Codebehind of page:

Imports Telerik.Web.UI
Imports ScoutingWithTheMouse.Database
Imports System.Data


Namespace ScoutingWithTheMouse.WebBrowser

    Partial Class Admin_MatchActivitiesToReqs
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                LoadOrgs()
                Me.rcbOrgs.SelectedValue = 0

                Me.rbLinked.Checked = True
            End If
        End Sub

        Private Sub LoadOrgs()
            Dim db As New swm_sqlsvr
            Dim myParams(0) As swm_sqlsvr.ProcParams
            myParams(0).Name = "ShowInactive"
            myParams(0).Value = 0
            Me.rcbOrgs.DataSource = db.SelectFromTable("Organization_Select", myParams)
            Me.rcbOrgs.DataBind()
            Dim rcbi As New RadComboBoxItem("Select Organization", 0)
            Me.rcbOrgs.Items.Insert(0, rcbi)
        End Sub

        Private Sub LoadLevels()
            Dim db As New swm_sqlsvr
            Dim myParams(2) As swm_sqlsvr.ProcParams
            myParams(0).Name = "ShowInactive"
            myParams(0).Value = 0
            myParams(1).Name = "pOrg"
            myParams(1).Value = Me.rcbOrgs.SelectedValue
            myParams(2).Name = "pLevelType"
            myParams(2).Value = 1
            Me.rcbLevels.DataSource = db.SelectFromTable("Levels_Select", myParams)
            Me.rcbLevels.DataBind()
            Dim rcbi As New RadComboBoxItem("Select Level", 0)
            Me.rcbLevels.Items.Insert(0, rcbi)
        End Sub

        Private Sub LoadReqs()
            Dim db As New swm_sqlsvr
            Dim myparams(1) As swm_sqlsvr.ProcParams
            myparams(0).Name = "ShowInactive"
            myparams(0).Value = 0
            myparams(1).Name = "pRank"
            myparams(1).Value = Me.rcbLevels.SelectedValue

            Me.rcbReqs.DataSource = db.SelectFromTable("ReqForDropdown_Select", myparams)
            DataBind()
            Dim rcbi As New RadComboBoxItem("Select Requirement", 0)
            Me.rcbReqs.Items.Insert(0, rcbi)
        End Sub

        Protected Sub rcbReqs_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbReqs.SelectedIndexChanged
            Dim db As New swm_sqlsvr
            Dim myparams(0) As swm_sqlsvr.ProcParams
            myparams(0).Name = "pReq"
            myparams(0).Value = Me.rcbReqs.SelectedValue
            Me.lblReq.Text = db.SelectFromTable("Req_SelectSingle", myparams).Tables(0).Rows(0).Item("longdesc")
            Me.rgLinked.Rebind()
        End Sub



        Protected Sub rcbOrgs_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbOrgs.SelectedIndexChanged
                LoadLevels()
        End Sub


        Protected Sub rcbLevels_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbLevels.SelectedIndexChanged
            LoadReqs()
        End Sub

        Protected Sub rgLinked_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgLinked.NeedDataSource
            Dim db As New swm_sqlsvr
            Dim myparams(1) As swm_sqlsvr.ProcParams
            myparams(0).Name = "pReq"
            If Me.rcbReqs.SelectedValue = Nothing Then
                myparams(0).Value = 0
            Else
                myparams(0).Value = Me.rcbReqs.SelectedValue
            End If
            myparams(1).Name = "pShowInactive"
            myparams(1).Value = 0

            Dim ds As New DataSet
            ds = db.SelectFromTable("ActsLinkedToReq", myparams)

            Me.rgLinked.DataSource = db.SelectFromTable("ActsLinkedToReq", myparams)
        End Sub


        Protected Sub UnlinkActivity(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles rgLinked.DeleteCommand
            Dim ID As Integer = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID").ToString
            Dim ReqID As Integer = IIf(Me.rcbReqs.SelectedValue = "", 0, Int(Val(Me.rcbReqs.SelectedValue)))
            Dim swm As New swm_sqlsvr
            swm.LinkUnlink(ID, ReqID, False)
            Me.rgLinked.Rebind()

        End Sub




    End Class

End Namespace

Hi all,

I'm stumped...everything on my page is happening twice. Every method is getting called twice. Any idea why something like this would happen?

Markup of page:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MatchActivitiesToReqs.aspx.vb" Inherits="ScoutingWithTheMouse.WebBrowser.Admin_MatchActivitiesToReqs" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Web.Design" Namespace="Telerik.Web.Design" TagPrefix="telerik" %>

<!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 runat="server">
    <title>Admin - Link Activities to Requirements</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    <telerik:RadScriptManager ID="rsmPage" runat="server"></telerik:RadScriptManager>
    
        <telerik:RadComboBox ID="rcbOrgs" runat="server" DataValueField="ID" DataTextField="OrgName" EnableViewState="true" OnSelectedIndexChanged="rcbOrgs_SelectedIndexChanged" AutoPostBack="true" EmptyMessage="Select an organization"/>
        <telerik:RadComboBox ID="rcbLevels" runat="server" DataValueField="ID" DataTextField="Description" OnSelectedIndexChanged="rcbLevels_SelectedIndexChanged" AutoPostBack="true" EmptyMessage="Select a level"/>
        <telerik:RadComboBox ID="rcbReqs" runat="server" datavaluefield="ID" DataTextField="SectionDesc" EmptyMessage="Select a requirement" DropDownWidth="300px" OnSelectedIndexChanged="rcbReqs_SelectedIndexChanged" AutoPostBack="true"/>
        <br />
        <asp:Label ID="lblReq" runat="server" Text="" />
        <br />
        Show: <asp:RadioButton ID="rbLinked" runat="server" text="Linked"/>
              <asp:RadioButton ID="rbUnlinked" runat="server" Text="Unlinked" />
        <asp:Button ID="btnShowActivities" runat="server" Text="Show" />
        
        <telerik:RadGrid ID="rgLinked" runat="server" OnNeedDataSource="rgLinked_NeedDataSource"
         AutoGenerateColumns="false" OnDeleteCommand="UnlinkActivity">
        <MasterTableView DataKeyNames="ID">
            <Columns>
                <telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" CommandName="Delete" />
                <telerik:GridBoundColumn UniqueName="Activity" DataField="activity" />
                <telerik:GridBoundColumn UniqueName="description" DataField="description" />
                <telerik:GridBoundColumn UniqueName="notes" DataField="notes" />
                <telerik:gridboundcolumn uniquename="LocationName" DataField="locationname" />
                <telerik:GridBoundColumn uniquename="LocationTypeDesc" datafield="LocTypeDesc" />
                <telerik:GridBoundColumn UniqueName="LocTypeNotes" DataField="LocTypeNotes" />
                <telerik:GridBoundColumn UniqueName="R2ANotes" DataField="R2ANotes" />
            </Columns>
        </MasterTableView>
        
        </telerik:RadGrid>
        
    </div>
    </form>
</body>
</html>

Codebehind of page:

Imports Telerik.Web.UI
Imports ScoutingWithTheMouse.Database
Imports System.Data


Namespace ScoutingWithTheMouse.WebBrowser

    Partial Class Admin_MatchActivitiesToReqs
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                LoadOrgs()
                Me.rcbOrgs.SelectedValue = 0

                Me.rbLinked.Checked = True
            End If
        End Sub

        Private Sub LoadOrgs()
            Dim db As New swm_sqlsvr
            Dim myParams(0) As swm_sqlsvr.ProcParams
            myParams(0).Name = "ShowInactive"
            myParams(0).Value = 0
            Me.rcbOrgs.DataSource = db.SelectFromTable("Organization_Select", myParams)
            Me.rcbOrgs.DataBind()
            Dim rcbi As New RadComboBoxItem("Select Organization", 0)
            Me.rcbOrgs.Items.Insert(0, rcbi)
        End Sub

        Private Sub LoadLevels()
            Dim db As New swm_sqlsvr
            Dim myParams(2) As swm_sqlsvr.ProcParams
            myParams(0).Name = "ShowInactive"
            myParams(0).Value = 0
            myParams(1).Name = "pOrg"
            myParams(1).Value = Me.rcbOrgs.SelectedValue
            myParams(2).Name = "pLevelType"
            myParams(2).Value = 1
            Me.rcbLevels.DataSource = db.SelectFromTable("Levels_Select", myParams)
            Me.rcbLevels.DataBind()
            Dim rcbi As New RadComboBoxItem("Select Level", 0)
            Me.rcbLevels.Items.Insert(0, rcbi)
        End Sub

        Private Sub LoadReqs()
            Dim db As New swm_sqlsvr
            Dim myparams(1) As swm_sqlsvr.ProcParams
            myparams(0).Name = "ShowInactive"
            myparams(0).Value = 0
            myparams(1).Name = "pRank"
            myparams(1).Value = Me.rcbLevels.SelectedValue

            Me.rcbReqs.DataSource = db.SelectFromTable("ReqForDropdown_Select", myparams)
            DataBind()
            Dim rcbi As New RadComboBoxItem("Select Requirement", 0)
            Me.rcbReqs.Items.Insert(0, rcbi)
        End Sub

        Protected Sub rcbReqs_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbReqs.SelectedIndexChanged
            Dim db As New swm_sqlsvr
            Dim myparams(0) As swm_sqlsvr.ProcParams
            myparams(0).Name = "pReq"
            myparams(0).Value = Me.rcbReqs.SelectedValue
            Me.lblReq.Text = db.SelectFromTable("Req_SelectSingle", myparams).Tables(0).Rows(0).Item("longdesc")
            Me.rgLinked.Rebind()
        End Sub



        Protected Sub rcbOrgs_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbOrgs.SelectedIndexChanged
                LoadLevels()
        End Sub


        Protected Sub rcbLevels_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbLevels.SelectedIndexChanged
            LoadReqs()
        End Sub

        Protected Sub rgLinked_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgLinked.NeedDataSource
            Dim db As New swm_sqlsvr
            Dim myparams(1) As swm_sqlsvr.ProcParams
            myparams(0).Name = "pReq"
            If Me.rcbReqs.SelectedValue = Nothing Then
                myparams(0).Value = 0
            Else
                myparams(0).Value = Me.rcbReqs.SelectedValue
            End If
            myparams(1).Name = "pShowInactive"
            myparams(1).Value = 0

            Dim ds As New DataSet
            ds = db.SelectFromTable("ActsLinkedToReq", myparams)

            Me.rgLinked.DataSource = db.SelectFromTable("ActsLinkedToReq", myparams)
        End Sub


        Protected Sub UnlinkActivity(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles rgLinked.DeleteCommand
            Dim ID As Integer = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID").ToString
            Dim ReqID As Integer = IIf(Me.rcbReqs.SelectedValue = "", 0, Int(Val(Me.rcbReqs.SelectedValue)))
            Dim swm As New swm_sqlsvr
            swm.LinkUnlink(ID, ReqID, False)
            Me.rgLinked.Rebind()

        End Sub




    End Class

End Namespace

Hi

Your aspx page codebehind & inherits tags are different than your class name in code behind
aspx code

CodeFile="MatchActivitiesToReqs.aspx.vb" Inherits="ScoutingWithTheMouse.WebBrowser.Admin_MatchActivitiesToReqs"

.aspx.vb

Partial Class Admin_MatchActivitiesToReqs

Let me know if it helps!!!

Thanks! But that's because of the namespace. Once the namespace is added to the pagename in the codebehind, it matches what's in the markup. But thanks. I always appreciate any help I can get ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.