Hello all,
im writing an ASP.NET application and i wonder if is there a way that can i obtain the ASP.NET markup code(e.g. <asp:button etc etc) of a control that it is created 'on the fly'.


Please answer me as soon as possible, :)
Alex

In short -- no. For standard <asp: you don't have to worry about tag prefixes either that you might with third party controls. Why are you trying to get at designer generated code in your application anyway? It isn't valid markup .. unless you are trying to write a code generator for making asp.net pages?

In short -- no. For standard <asp: you don't have to worry about tag prefixes either that you might with third party controls. Why are you trying to get at designer generated code in your application anyway? It isn't valid markup .. unless you are trying to write a code generator for making asp.net pages?

That's exactly what i want to do. do you have any idea how can i do this?

Or can you provide me with other solutions that can help me in this situation? :S

Can you just build a list of known controls and use that? When you drop a control on the designer it calls RegisterTagPrefix() which handles getting the prefix name if it is already in use etc etc.

I would recommend dropping the controls on a form and getting the string values and going from there. You also have to update the .designer.cs file with the control names and classes. This isn't a straightforward thing to do but it can be done

Drop a control on to a web form and copy the code from the designer. Get the list of all designer generated code you need from hand. It shouldn't take more than 30 minutes to get them all. I think it may take hours to reflect out the information you need.. if its even possible.

This article has been dead for over six months. Start a new discussion instead.