I have a userControl in which I load three different user control as Left,right and middle panel.
My middle panel user control have 3 more user control loaded on it
I want to pass a value from my middle panel user control to right panel user control on click of a link button.
Can please any one guide how to do so.?
I would add a method on the user control you need to pass data to.
Then you can call that method from the container and pass in the value.
Another approach is to put the value in session or viewstate.
Using Session or cookie this is easy way to pass value one control to another control or one page to another page
Related
I am trying to add user controls once the page is loaded.In the page depending on the selection (dropdown or checkbox) the respective user control will be added.I know that if we need to add user controls I need to add them in the Page_InIt method.but I will know which user control to add only when the page is completely loaded and the user has made a selection.
The page has Update panel so there will be many Async postback's so I also need to look at how to persist the user-control once it is added to the page.
Any help will be grateful.
You can get user selection using the
Request.Form["YourControlID"].
Check this link to know about getting postback data from forms
Read Post Data submitted to ASP.Net Form
Also read this post about using dynamic controls in ASP.NET. It very helpfull.
TRULY UNDERSTANDING DYNAMIC CONTROLS
i have made a user control as report .Now this control has a button on whose click another user control is being called.the values gets passed correctly,also gets binded to the grid ..but finally the second control doesn't get displayed on the screen .I can't paste my code here since it is very long.am i missing out nothing for interaction between two user controls?
try to check the BringToFront method,
have a look on this link
I have a form with several text fields, a couple of drop down lists, and a custom asp.net control.
The requirement I have is that when the values of certain fields ( some are in the main form, some are inside the control ) the user will be alerted that the settings will not take place unless they also restart the processing and will have the option to reset it. If they exercise this option by pressing on the restart button, we execute an additional restart() method call on the server side on top of everything else.
In order to create this alert system I need to know when these required fields have changed. For the fields in the main form/page I store the original values in hidden fields when the page gets created (possible because the page is static). Then when the submit button is pressed I check the current values against the original values stored. If any of them differ I will alert the user.
For the fields in the custom control, I created a boolean property that indicates whether changes in the fields of interest took place. This control is highly dynamic contains a variable number of lists, some of them with over 100 items that can be selected or deselected. So this boolean property is able to identify if the changes I am looking for took place.
The problem is I need to get the value of this property when the user clicks on Submit, otherwise it will not contain the right value. But at the same time I want to avoid a postback. I do not want the whole page to reload. I want to get that value asynchronously somehow.
Since the whole page is stateless the question is how do I accomplish this? How do I accomplish the call to the property? And after I make the call and I get the result where do I store it so it's accessible from javascript code on the client side.
You can try putting a timer control in your ajax panel. Then on a set interval, you will evaluate the boolean property in your code behind.
Alternatively you can check the hidden field "changed" event using JavaScript or jQuery
http://api.jquery.com/change/
The page has already run its' initialise/load sequences etc but then catches an event. How can I then send value(s) from this event to the client.
That probably doesn't make much sense, hopefully this will clarify:
I have a grid (Telerik RadGrid) in a user control (A) and when the user selects a row in that grid, I want to update another user control (B) with the selection.
I have wired up an event so that user control B is notified of the newly selected value however setting say a textbox value in user control B server-side isn't rendering (I'm presuming because the grid selection is happening over AJAX and therefore user control B never re-renders?).
So, how can I either force user control B to re-render with the updated values or how can I send these values to the client using an AJAX like call? Or am I going about this the wrong way entirely. The core question really is how can I get data from user control A to user control B when the page isn't being posted back.
Thanks!
There are ways to push data from the server (one is called "long polling") but this does not apply here. Are you sure that your grid event fires and the event handler executes? If you are, and you update control (B) but the change does not appear, put control (B) or both into an asp:UpdatePanel and call the Update() method on it in the event handler after changing the value. This will trigger another Ajax postback that should refresh your control.
I have a ASP.net page with couple of tabpanels. When a user hits submit button when he is on the First tab I am showing the user the second tab control. Ontabindexchanged I am dynamically creating a usercontrol and passing some values to the control.
Now when the user is in the 2nd tab and if he navigates to the first tab, I need to pass some values to the first tab.
At the tabcontainer level how do I pass values between tabs?
I think what your problem is, you need to maintain viewstate of your dynamically created controls, otherwise there is no problem to pass values between tabs. like..
tab1TextBox1.text=tab2Textbox2.text (Since your controls are in AJAX tab panel, no need to find control from tab panel)
For Maintaining viewstate of your dynamically created user control, you need to create your control in page_init() event.