Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2557
  • Last Modified:

Problem With Refresh parent page after save data in dataview web part..

Hii All,

  I did one dataview web part in sharepoint site. and i have one hyperlink to open newform.aspx. i open that form in another page like child page. and i removed sharepoint save and cancle button and i wrote code for save and cancel is .. <input Type="button" Value="Save" Onclick="javascript:{ddwrt:Genfireserverevent{'_commit';};window.opener.document.location.reload;self.close();>
So i used window.opener.document.location.reload for refresh and self.close(); for close child window.
But when i click SAVE button then first it refresh the parent window and then it save the data. so i dont get resule. everytime i have to refresh manually..

How can i fix this problem?? Can i refresh twise so i can remove this problem..Please anyone help me ..
And one more thing is an another list it works fine but only this project tasks list it does not work..

Thank You..
Dipesh
0
guessdip
Asked:
guessdip
  • 8
  • 4
1 Solution
 
jyotisinhaCommented:
Dipesh
How about using var ret=window.showModalDialog instead of window.open?
If showModalDialog is possible, that offers more control over controling the postback at parent page. Based on save (successful or failed), you can return a true or false from popup page using window.returnvalue= <true or false>.
if true is returned, parent page's server event would be fired and your page will get reloaded.

Hope this helps!
0
 
guessdipAuthor Commented:
Hii jyoti sinha,
 
   Exactly i used hyperlink for open pop window means newform like <a href http:abc.com?project=project1"Target=-blank...i used target = blank so it open this form in another window..i did not use show model or window.open...

I dont know what to do. exactly first it refresh the page and then save the data so i am not getting desire output. i need refresh again or try to set time or think about sequence of execute command..

What to do ??
Thanks
Dipesh
0
 
jyotisinhaCommented:
Hope I am getting your question right! using showmodaldialog, you could do like this

1.) On parent page,
instead of using <a href http:abc.com?project=project1"Target=-blank
you can use following:

 <a href=# onClick='return openpopup();'>your link text</a>

In javascript write the following function:

function openpopup()
{
         var windowFeatures =
               'dialogWidth:800px; dialogHeight:500px; ' +
                'center:yes; help:no; resizable:no; status:no;';
             return window.showModalDialog(yourchildpageURL,' ',windowFeatures);
}

and
2.) on Child page, you can do following:
<input Type="button" Value="Save" Onclick="javascript:{ddwrt:Genfireserverevent{'_commit';};window.returnValue=true; window.close();>

Hope this works!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
guessdipAuthor Commented:
Hii,
   I am using sharepoint designer so i am using sxlt language so i am confuse to write javascript function. can i write code directly in hyperlink??i wrote but i got error...


Thanks..
0
 
guessdipAuthor Commented:
Hii jyoti,

 When i write this  <a href=# onClick='return openpopup();'>your link text</a>
then i get error "" This web part does not have valid xslt style sheet :Error: A string literator was  expected;But no opening quota character found.""

Thanks
0
 
guessdipAuthor Commented:
Hii jyoti,
  i used  <a href="#" onClick='return openpopup();'>your link text</a>
And i wrote fuction
But when i click on that link then page is not open.. Any idea ??
0
 
guessdipAuthor Commented:
Hiii,
  i used your code it works fine for opening pop pup window and close but it is not refresh so i dont get data,i have to refresh manually...Any idea to refresh page after using showmodelwindow..


Thank You
Dipesh
0
 
jyotisinhaCommented:
oops!!! It requires server control with events on codebehind...
Two options I can see here...
1.) instead of <a href... , use a <ASP:linkbutton> control and you may keep the server side event of this linkbutton without any code, then when the openpopup returns true, it will try to execute the server side 'click' event of link button. Since you keep the server side event blank, so it will only postback the page and refresh that. OR
2.) If you can not do away with <a href..., then put a server side button control (button1)on page and make that visible false. Make sure, you have created button1_click event in code behind. Now, make a slight change in openpopup function. See, I have added __doPostBack in the end of the function.

function openpopup()
{
         var windowFeatures =
               'dialogWidth:800px; dialogHeight:500px; ' +
                'center:yes; help:no; resizable:no; status:no;';
             return window.showModalDialog(yourchildpageURL,' ',windowFeatures);
             __doPostBack("Button1","");
}

hope this works for you!
0
 
guessdipAuthor Commented:
Hii jyoti,
  When i use showmodeldialog and when i close this then another normal window open with same url. so everytime i have to close this window. I used window.showmodeldialog(url,window,windowfeature)




thanks
Dipesh
0
 
jyotisinhaCommented:
got it...in <head> section of aspx page,  just use
like <head>
 <base target ="_self"/>
</head>
0
 
guessdipAuthor Commented:
Hii i already used,__self in hyperlink target property...
0
 
guessdipAuthor Commented:
Thanks Jyoti,,If you have time then just take a look of my new question..
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now