French_boy
French_boy

Reputation: 3

How to pass a parameter from javascript to a UserControl?

In my ASP.Net application, there's a UserControl called EmployeesUserControl which is shown through a JQuery modal dialog.

Before showing the Employees, I've got to pass a filter criteria which is the entity that the employee is belong to. My question is that how can I pass the value from javascript to the UserControl?


What I tried so far is that I created a HiddenControl called SelectedEntityHiddenControl and I set it a value before showing the popup, hence, when the popup is shown and the Page_Load event handler of the UserControl is called, then I read the value of the hidden control and filter by it. But I don't think it's a good implementation what I've already done.

Any suggestion!

Upvotes: 0

Views: 1406

Answers (1)

Thorsten Hans
Thorsten Hans

Reputation: 2683

I think it's a good solution. I'm also using HiddenFields to pass values from JS to the ASP.NET Engine and back.

You've to ensure that your values are passed to the asp.net engine at the correct moment within the lifecycle.

Upvotes: 1

Related Questions