Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5977739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:24:50+00:00 2026-05-22T21:24:50+00:00

I am trying to add a parameter to the deleting event of an ObjectDataSource

  • 0

I am trying to add a parameter to the deleting event of an ObjectDataSource as in the example below from msdn. I generated an event handler for the ObjectDataSource’s deleting event, and it had the same signature as in the example, however, when I try to clear the paramsFromPage as in the example, I receive an error stating that paramsFromPage is readonly. Is there something I need to change somewhere else?

This example comes from the following msdn page:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.deleting%28v=VS.90%29.aspx

Private Sub NorthwindEmployeeDeleting(ByVal source As Object, ByVal e As ObjectDataSourceMethodEventArgs)

    ' The GridView passes the ID of the employee
    ' to be deleted. However, the business object, EmployeeLogic,
    ' requires a NorthwindEmployee parameter, named "ne". Create
    ' it now and add it to the parameters collection.
    Dim paramsFromPage As IDictionary = e.InputParameters

    If Not paramsFromPage("EmpID") Is Nothing Then

        Dim ne As New NorthwindEmployee(paramsFromPage("EmpID").ToString())
        ' Remove the old EmpID parameter.
        paramsFromPage.Clear()
        paramsFromPage.Add("ne", ne)


    End If
End Sub ' NorthwindEmployeeDeleting

EDIT:
The following is my code

Protected Sub QueueDataSource_Deleting(ByVal sender As Object, ByVal e As ObjectDataSourceMethodEventArgs) Handles QueueDataSource.Deleting
    Dim paramsFromPage As IDictionary = e.InputParameters
    Dim queue As New QueueData

    If Not paramsFromPage("QueueNamek__BackingField") Is Nothing Then
        queue.QueueNamek__BackingField = paramsFromPage("QueueNamek__BackingField")
    End If

    If Not paramsFromPage("ServerNamek__BackingField") Is Nothing Then
        queue.ServerNamek__BackingField = paramsFromPage("ServerNamek__BackingField")
    End If

    paramsFromPage.Add("queue", queue)
End Sub

The error “The OrderedDictionary is readonly and cannot be modified.” is thrown when an attempt is made to Add to the ordered dictionary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:24:50+00:00Added an answer on May 22, 2026 at 9:24 pm

    I found a good workaround to the solution Microsoft suggested. I discovered that while parameters cannot be added or removed programmatically, they can be added declaratively, and the parameters needed for the delete function are added automatically. Also, the parameters that are in the collection can be modified programatically inside the deleting event.

    Here is my solution:

    ' Store the index of the row being deleted
    Protected Sub QueueGrid_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles QueueGrid.RowDeleting
        rowChosen = e.RowIndex
    End Sub
    
    ' Prepare parameter to be sent to deleting function
    Protected Sub QueueDataSource_Deleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles QueueDataSource.Deleting
        Dim queue As QueueData = e.InputParameters("queue")
    
        With queue
            .QueueNamek__BackingField = QueueGrid.Rows(rowChosen).Cells(2).Text
            .ServerNamek__BackingField = QueueGrid.Rows(rowChosen).Cells(3).Text
        End With
    End Sub
    

    I am just wondering if there is a better way to get the data from the cells so that changing the column order does not break this code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a target= parameter to an EE-generated URL. If I turn
I'm trying to add click event handlers to a bunch of dynamically generated divs
I'm trying to add parameters to an objectDataSource at runtime like this: Parameter objCustomerParameter
Trying to add init parameter names to a list in init(ServletConfig) method. public void
In C#, I am trying to add values to a parameter that accepts enumerated
I'm trying to add a handler, but as soon as I'm targetting a method
I'm trying to add a parameter to a div once its dropped onto a
I am trying to add an unescaped parameter to a URL with the help
I'm trying to add in an optional parameter in a template function... Basically a
I am trying to add a parameter to a sqlDataAdapter. I have tried to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.