Link to home
Start Free TrialLog in
Avatar of guessdip
guessdip

asked on

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
Avatar of jyotisinha
jyotisinha

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!
Avatar of guessdip

ASKER

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
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!
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..
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
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 ??
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
ASKER CERTIFIED SOLUTION
Avatar of jyotisinha
jyotisinha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
got it...in <head> section of aspx page,  just use
like <head>
 <base target ="_self"/>
</head>
Hii i already used,__self in hyperlink target property...
Thanks Jyoti,,If you have time then just take a look of my new question..