objectdatasource update method at code behind

I have a objectdatasource with specified UpdateParameters at page,
and I want to do the objectdatasource.update() at code behind
How do I full filled all the required updateparameters at code behind before I call the update()?

I've tried ODS1.UpdateParameters.Insert("cID", string123)

it didn't work, popup an error msg says "cannot find generic method "update" that has parameters (cID)

any help?
<asp:ObjectDataSource ID="ODS1" runat="server" 
              OldValuesParameterFormatString="original_{0}" UpdateMethod="Update">
              <UpdateParameters>
                  <asp:Parameter Name="cID" Type="Int32" />
                  <asp:Parameter Name="cName" Type="String" />
              </UpdateParameters>
            </asp:ObjectDataSource>

Open in new window

LVL 3
joeyluAsked:
Who is Participating?
 
drypzConnect With a Mentor Commented:
Hi! You may try this

        ODS1.UpdateParameters(0).DefaultValue = "Value1"
        ODS1.UpdateParameters(1).DefaultValue = "Value2"
0
 
joeyluAuthor Commented:
yes, i was forced to use defaultvalues, but it doesn't quite the same anyway, guess there should be a better way
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.