Showing posts with label child. Show all posts
Showing posts with label child. Show all posts

Thursday, March 29, 2012

Pop Up/Refresh Issue

I have a parent page that contains a datagrid. On this page is a link to "Add New" record. I have done this by opening a child/pop up so they can enter the data in a new window. When the user submits, the parent page reloads and refreshes the data. Here is the code in the child page:

btnAdd.Attributes.Add("onclick", "window.opener.location.reload();");

I kinda have two problems here, one I can live with...for now.

Problem 1: When the page reloads, the user has to click "Retry". This works, but is a bit sloppy. I've searched a few different methods on this forum, but none seem to submit and refresh my data. (I can't simply refresh because I have a few panels on the parent that throw a wrench into it)

Problem 2: The line that I posted earlier is fine, and works well; however I do have some validation (server side) on the child form. If the validation in the btnAdd_Click event isn't a success, I would like to avoid reloading the parent. How would I go about doing that?

Thanks.

Just to clarify a bit, I want to check a condition before I have my js reload the parent page.

Let's say:

If (someCondition)

{

//reload parent page

}

else

{

// don't reload parent page

}

Any suggestions?


Instead of spamming the forum with much of the same problem, I'll add to this one.

I would also like to somehow clear the last submmited button on the parent from the child. Let me try to explain.

On the parent the user may press a button which kicks off validation on the server. If validation on the server fails, a message on the page is displayed. (Parent) Now, if the user decides to add a record at this time via the pop up or child, hitting update on the child will reload the parent page; however, in this case my grid on the parent won't refresh because it's executing the submit on the parent. Therefore displaying "validation failed", when in fact it didn't.

Eh, I know this probably sounds messy, but if someone can help with this or any of my other pop up/refresh problems in this thread, I would appreciate it.


I don't know of this is going to help you or not but here is my 2cents. On the child pop up page when the user submits the informationyou can send a value of true to the parent which will represent thatthe child form has been submitted. This value can be send usingQueryString or Session State. When the parent page recieves thisinformation it can referesh it.
Does that help ?

Friday, March 16, 2012

Populating DDL with Parent/Child data?

Hi all,
How can we populate a dropdown list with parent and child values like the forum jump dropdown at the bottom of this page?
This dropdown shows the group names and then the forum names below each group title.
Many thanks
RGHow do you get the relationship delivered? In a dataset or do you connect each time that you enter a new parent id?
You can add the items to the DDL by using Items.Add(new ListItem(..., ...));
Grz, Kris.
If you view the source of the pages of these forums, you will see that there is nothing special going on with the dropdownlist at the bottom. The subheadings and formatting are created with blank rows and such. The headings are just the same as any of the "actual" items and selecting them causes a postback (albeit a postback that does nothing).
<option value="">(please select)</option>
<option value=""></option>
<option value="/">Forums Home</option>
<option value="/search/">|- Search Forums</option>
<option value="/TopicsActive.aspx">|- Active Topics</option>
<option value="/TopicsNotAnswered.aspx">|- Unanswered Posts</option>
<option value=""></option>
<option value="User Options">User Options</option>
<option value="/user/EditProfile.aspx?ReturnUrl=/ShowForum.aspx?ForumID=18">|- My Control Panel</option>
<option value="/user/PrivateMessages/">|- My Private Messages</option>
<option value="/user/MyForums.aspx">|- My Forums</option>
<option value=""></option>

You can see some usefulsamples here.
If you don't want to code it yourself, consider using a third-party control likeEasyListBoxor Andy Smith'sListLink (free, but unsupported and not as user-friendly).
FWIW...