Groups | Blog | Home
all groups > asp.net building controls > october 2003 >

asp.net building controls : Problem with Eventhandling in user control


Franz Fitz
10/30/2003 8:18:29 AM
Hi, I get really struggled, so it's my last chance to get some answers here.

My problem is: I would like to create a web user control that is based on a
XML structure. This XML structure is rendered thru a XSLT transformation on
the server (this would seperate the logic fro the design, and so, the
end-user can override the complete ui)

Example: I want to build a simple control with one textBox. The XML Data
contains a node named credentials and a node named username. The idea is now
to have the HTML Code for the UI rendering in the XSLT file. The logic and
the eventhandler should remain in the class.

The rendering is no problem, and it's handy to use. Only the eventhandlers
like Text_Changed are not working.

If anyone has an idea on why this is happening, I would
greatly appreciate it.

Thanks,
Franz

John Saunders
10/30/2003 5:10:20 PM
[quoted text, click to view]

Franz, are you saying that you have a control which performs an XSLT
transform on some XML in order to generate HTML? So the TextChanged event
you're referring to would be for a generated <input> tag?

If that's the case, did you generate the same code on your <input> tag as
ASP.NET would have generated for a TextBox control? In particular, do you
have the client-side event handling necessary to post back to the server?

Also, if you're creating your own <input> tags, note that you don't get
TextChanged events for free. Your control will need to somehow save the
value of the text box in ViewState, and handle the PostBack to see if the
ViewState value differs from the current value, and you will then have to
raise the event on your own.

I hope I'm misunderstanding you.
--
John

AddThis Social Bookmark Button