I have on server control(dropdown) and One button.user can select some values in dropdown and click button.I have to show a pop-up.In this pop-up I have show data based upon value selected in dropdown.How to access a dropdown in codebehind of pop-up screen.I am loading a .aspx in pop-up using javascript.
Why not just pass the selected value of the dropdownlist as a querystring parameter to the popup page?
That's the way i'd do it.
If you dont want to do it that way, you can access the parent window by using window.opener.document.
So something like:
window.opener.document.getElementById('yourDDLId').value;
Still i'd recommend passing through as querystring param. Simple and easy.
Related
What I want is to open a new popup from the server side, this pop up has a form with three fields, and then return this three fields to the parent page. But I want this fields in the server side, in the VB.NET code. Is this possible?
Is a modal popup window acceptable? If so, you could put the variables in an update panel, and use the server side event of the button that causes a postback on the modal to force the the update panel to update.
Create a form to show as popup
Display it
Perform a POST request onto the parent form to pass the values
or
save input into Session vaariable and read it on popup close
I have a GridView on PageA, I wish to be able to call the DataBind() method of the GridView from PageB?
Basically PageB is a form which will be contained in a pop up control, when the user fills in the fields of the form on PageB and submits it I will close the pop up control, then I want to refresh the GridView on the parent page (PageA), how would I go about doing that?
Write a javascript function on Page A like RefreshGrid, you can write various ways to refresh grid from this javascript function e.g.
1) put your grid inside an update panel and create a trigger button control on that update panel , call this trigger control's click event in javascript , this will partial post back the page and refresh the update panel. There are other ways too..
2) From popup on popup close button, write following line
window.opener.RefreshGrid(); window.close();
Thats it.
If you want to pass any parameter you can pass through as argument to RefreshGrid function.
Still there are many ways , this is the one I use.
There is a tab menu which was created by asp.net control. Now I'm changing this with a new tab menu I made with javascript. There is an event on third tab and when i click the tab it's posting back with asp.net ajax as asyn. but it takes me to the first tab after postingback every time but I don't want to change the tab after this. it must be stay on the third tab just must be changed content that's all. How do I solve it?
thank you
If your home-made tabset is in the update panel, then it will be part of the partial update. Your tab control needs to remember it's viewstate so that when it is rendered after a postback (or partial update) it will render with the right selected tab. I suggest using a hidden field on the page that holds the value or index of the selected tab. Then, when you go to render the tabset from a postback, you read from that hidden field and know what tab is selected and render as such.
I have a GridView that lists a bunch of items and one of the columns has a link that displays a modal (AjaxToolkit ModalPopupExtender). Let's call that link "Show". In that modal, I have a asp:button for saving the data entered in that modal. Let's call that button "Save"
So when the user clicks on a "Show" link in a certain row, I'd like write some javascript that sets something in the "Save" button, so that in my code-behind, I can handle "Save".Command and use the CommandEventArgs parameter to get the value.
Is this possible, or do I just need to use a hidden input tag and set its value?
Not a direct answer to your question, but another possible way of solving the problem:
Place a HiddenField control on the page. In your code-behind, before displaying the modal popup, set the value of that control to the ID of the row that was clicked (or the row number, or some identifying value). Then in the code-behind of your Save button, you can just read the value of the HiddenField.
Well, after continuing the research, it looks like it cannot be done. The CommandArgument property might reside in the ViewState, but for this case, it is completely server side and cannot be changed using javascript.
If you are using Updatepanel, you need to place the Hiddenfield inside the Updatepanel. Otherwise you will not be able to get/set the value stored in hiddenfield.
How should I get a value displayed in the DropDownList when redirected through a cancel buttton. The value in the page where cancel button is there in a TextBox should be caught in the DropDownList.
This DropDownList has SelectedIndexChanged event also fired for which on selection of a country in the list we get a ListView displayed in the same page. In that ListView we have an add button which will redirect us to another page called addcountry in which we have few controls. In those controls one TextBox I am getting value through QueryString in an enabled False state. Now again I need that value displayed in the DropDownList when I click cancel button.
How can I solve this problem?
Using $_POST and $_GET Variables you should be able to retreive almost any value from a form and put it in the right place on a new page, this right place can be one of your drop down list element...
To make absolutly sure your Cancel Button will send the good value to the right page put it in an independant form that has your new page (where you have yout dropdown list) as its action, and in this seperate form put an hidden field that holds the specific value you wanna see in this dd list ...
Hope I am clear but starting with your very "fuzzy" and blur question It is hard to help you.