asp:ControlParameter vs. asp:FormParameter in Master Page

I hit what I considered to be an annoying “issue” in ASP.NET 2.0 the other day that I thought I would share so others can avoid the problem.

I created a form with some text controls and an sqldatasource that called a stored proc while accepting parameters via asp:FormParameter. This worked great and tested out fine. Once I added the same code into a Master Page, everything began getting passed as “NULL” (it was no longer finding the FormParameters on the page. After troubleshooting for more time than I preferred, I found out that I can achieve success by using the asp:ControlParameter.

Everything is now working fine, and if you have come up to the same thing, I hope this helps you too.

3 Comments on “asp:ControlParameter vs. asp:FormParameter in Master Page”

  1. I was having the exact same error and this fixed it! Thank you so much!

    Also note that with ControlParameter, you cannot use FormField. I’m using ControlID instead.

Leave a Reply

Your email address will not be published. Required fields are marked *