Search code examples
c#asp.netobjectdatasourcenemerle

How to cancel binding ObjectDataSource?


CheckPara is my OnDataBinding procedure

SqlDataSource1 is ObjectDataSource (it's only confusing name)

Language is Nemerle, but if you know C# you can read it easy

  protected virtual CheckPara(_ : object,  _ : System.EventArgs) : void
      {
        foreach(x is Parameter in SqlDataSource1.SelectParameters)
            when(x.DefaultValue=="") //Cancel binding
      }

so how can I cancel binding when there is not fully configurated ObjectDataSource ?

Or... how can I run binding only when I done with all parameters ?


Solution

  • Use ObjectDataSource's Selecting event, place your for loop of select and if you want to cancel binding it, use e.Cacnel = true and you are done!!