views:

219

answers:

1

I saw a couple of similar questions here, but what I'm trying to do is a bit different.

I want to have a way to give users some feedback on their actions which can be controlled from both client and server side.

I've build a UserControl with a label (label's text property is exposed) and some JS which hides the label shortly after the Page_Load event. This works fine for server side, but I'm having trouble setting the label's text with JS (from parent page).

The question boils down to these two points:

  1. Is there a way to set the public property on the child user control with JS?
  2. Is there a better implementation of user notification in ASP.NET (both client and server side)

EDIT

ended up adding a bugus class to a label to find it in the child user control, not the best solution - but it works for now

+1  A: 

Looks like your setting the child control's ID dynamically? If so you either going to have to give it a a unique CSS class that you can find later per my example code or you can traverse the dom a little to find it. Like:

$("div div span.theControl").html("Hey there");

Maybe I don't understand this question but wouldn't this work?

$(".theControl").html('Look users, you did something cool');

Per your comment I think they key to your problem is not really how you can find your child control but rather what kind of values or classes you can give your child control so your jQuery can find it.

jfar
the question is: HOW TO GET THE ID OF THE LABEL IN CHILD USER CONTROL?
roman m