How to send asynchronous updates to Visual Webpart?
Hi Guys,
I have a visual webpart which does set of tasks on a single button is click event. So at the end of each task I need to update the status of that task back to the UI. How to do this?
Thanks in advance.
nasayoo
Hi nasayoo,
I suggest you can use asynchronous web part to achieve this.
Here are some demos for your reference:
More information about Asynchronous web part:
http://blogs.msdn.com/b/pavankumar/archive/2009/02/16/code-sample-for-a-asynchronous-webpart.aspx
http://sadomovalex.blogspot.com/2012/07/create-asynchronous-web-parts-for.html
Best regards,
Zhengyu Guo
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you
have feedback for TechNet Subscriber Support, contact [email protected]
Zhengyu Guo
TechNet Community Support
Similar Messages
-
How to send an updated list using batch job
Hi All,
The program displays data on the screen, if the data looks ok, then there is an option to update.
When I run update, the program submits a batch job and the basic list gets updated, but my batch job is still sending the data on the screen. how can i send the updated list using batch job.
Ex: output of the program
1 2
there is an update button on the screen, when i press update button, my program submits in batch job, the above list becomes
1 2
3 4
but when i check the spool, it shows the o/p as 1 2 ..it is not sending the updated list.
Please suggest me how to send the updated data
Thanks,
KumarHi Krishna,
I have added a button on the alv list. when i press update button, my program updates the list, then submits the batch job. I am attaching the sample test program i am trying with, please suggest me how can i get the updated list.
*& Report ZTESTSSSSS
REPORT ZTESTSSSSS.
DATA: gt_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat type slis_t_fieldcat_alv,
gt_sort TYPE slis_t_sortinfo_alv,
g_repid LIKE sy-repid,
gt_layout TYPE slis_layout_alv.
start-of-selection.
lt_return-type = 'S'.
lt_return-message = 'test message'.
append lt_return.
CLEAR gt_fieldcat.
gt_fieldcat-fieldname = 'TYPE'.
gt_fieldcat-outputlen = '3'.
gt_fieldcat-tabname = 'LT_RETURN'.
gt_fieldcat-seltext_l = 'Type'.
gt_fieldcat-seltext_m = 'Type'.
gt_fieldcat-seltext_s = 'Type'.
APPEND gt_fieldcat TO lt_fieldcat.
CLEAR gt_fieldcat.
gt_fieldcat-fieldname = 'MESSAGE'.
gt_fieldcat-outputlen = '15'.
gt_fieldcat-tabname = 'LT_RETURN'.
gt_fieldcat-seltext_l = 'Message'.
gt_fieldcat-seltext_m = 'Message'.
gt_fieldcat-seltext_s = 'Message'.
APPEND gt_fieldcat TO lt_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = lt_fieldcat
TABLES
T_OUTTAB = lt_return
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*& Form set_pf_status
text
-->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD'.
ENDFORM. "Set_pf_status
*& Form user_command
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: li_count TYPE I.
IF r_ucomm EQ 'UPD'.
Adding another message
lt_return-type = 'S'.
lt_return-message = 'Another test message'.
APPEND lt_return.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
l_upd = 'X'.
LOOP AT lt_return.
WRITE: / lt_return-type, lt_return-message.
ENDLOOP.
IF sy-batch IS INITIAL.
l_upd = 'X'.
Open the Job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_name
IMPORTING
jobcount = w_number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT ('ZTESTSSSSS') VIA JOB w_name NUMBER w_number
AND RETURN
WITH p_recnnr = p_recnnr.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_number
jobname = w_name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "User_command
Thanks,
Kumar -
Asynchronous visual webpart for SharePoint 2013
HI,
How to create asynchronous visual webparts in SharePoint 2013 (VS 2012) . I can see lot of examples for 2010 version, but not for SP 2013.
I have 2 visual webparts, which I want to make it as a asynchronous webpart. One webpart has the code written in Javascript client object model(loads lot of images), another is a server side webpart which has a SPGridview.
Is there any sample code available for SP 2013?
ThanksHi,
Please try to convert the SharePoint 2010 project to SharePoint 2013.
http://sadomovalex.blogspot.kr/2013/02/convert-visual-studio-sharepoint-2010.html
In SharePoint 2013, we can create a visual web part, then we can use jQuery Ajax and REST API to achieve asynchronous data loading.
More information:
http://www.dotnetcurry.com/showarticle.aspx?ID=1009
http://asyncwebpartframewrk.codeplex.com/releases/view/52459
Thanks,
Dennis Guo
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Dennis Guo
TechNet Community Support -
How to change the default text "There are no items to show in this view" in the visual webpart
Hi,
I am using a visual webpart and in that if there are no items in the list it is showing the default text "There are no items to show in this view." I want to change this default text.
I checked the forums here there are multiple ways are shown but no one is working for me.
Kindly help me to change this text.
Thanks in advanced.It seems you're retrieving items inside a specific you.. why not having a <div> inside you're visual web part and check to see if the count of items retrieved is > 0 then insert that in the div, otherwise, insert your custom message and not rendering
the web part itself. What you're describing is the default message from SharePoint which comes from default views, and this can be changed from xslt in SP 2010 or in JSLink in SP 2013, here's a link how to do so in JSLink :
http://www.idubbs.com/blog/2015/jslink-csr-to-override-there-are-no-items-to-show-in-this-view/ .
But as said, since you're doing a visual web part, keep your stuff in the visual web part and check for the count of items before adding the rendered data to your div.
Mohamed Derhalli
SharePoint Consultant
Blog: SharePoint Thoughts
Twitter:
LinkedIn:
-
How to send the PDF file to FAX will the nast table updates
Hi all,
How to send the PDF file to FAX. Will the nast table updates ( which fields updates ).
Need is once fax is send for that delivery, again it should not fax again. Will the nast table helps to check the sent fax.
Please give me sutable suggessions....Have you checked Forums » Community Discussions » Code Snippets
I believe there were some examples on converting/sending PDF.
Or check FM 'SO_DOCUMENT_SEND_API1' and documentation for it. -
How to send custom email asynchronously?
Hi All,
I am using code to send custom email like:
SmtpClient smtpClient = new SmtpClient(smtpServer);
NetworkCredential oCredential = new NetworkCredential("", "");
try
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = oCredential;
smtpClient.Send(mailMessage);
catch (Exception)
This code working fine but how to send email asynchronously?
Thanks in advance!Hi Steve & Amit,
Thanks for you reply, Here is my complete code:
public static void Sendmail(string To, string subject, string Body, string frommail)
string smtpServer = SPAdministrationWebApplication.Local.OutboundMailServiceInstance.Server.Address;
string smtpFrom = SPAdministrationWebApplication.Local.OutboundMailSenderAddress;
string smtpReplyTo = SPAdministrationWebApplication.Local.OutboundMailReplyToAddress;
MailMessage mailMessage = new MailMessage();
System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress(frommail, "My Intranet");
mailMessage.From = from;
mailMessage.To.Add(new MailAddress(To));
mailMessage.Subject = subject;
mailMessage.IsBodyHtml = true;
mailMessage.Priority = MailPriority.High;
mailMessage.Body = "<html><body>" + Body + "<br><br>With Regards,<br><b>My Intranet</b></body></html>";
SmtpClient smtpClient = new SmtpClient(smtpServer);
NetworkCredential oCredential = new NetworkCredential("", "");
try
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = oCredential;
smtpClient.Send(mailMessage);
catch (Exception)
Could you please suggest me how to implement you solution, thanks! -
How can I send an update to CRM Middleware after changing BUPA longtext
Hi folks,
I am looking for the easiest way to send an update/insert of BP longtext change to SAP CRM Middleware (& MobileSales). I have implemented save of the text with function save_text within of a CRM application for changing bp data.
Text is available to standard CRM transaction bp, but now updates have been send to subscribed Mobile Sales clients.
I have already checked the bapi_bupa* functions, but it seems that they contain no notes/longtext segment.
Thanks for any help.
DanielHi Daniel,
just wondering if you had a solution for this as I have the same issue to solve as well.
thanks, regards. -
Visual webpart refactoring - ascx not getting updated
Hello,
I have created a visual webpart in one sharepoint 2013 project and then moved the webpart to another sharepoint 2013 project. It is getting deployed without any problem. The problem is the changes to my .ascx files are not reflecting when deployed..
any ideas?
Thanks,
SanthoshHi Santhosh,
Are you working on same UserControl webpart in another SP 2013 Project?
Also double check your project solution's webpart feature contains new webpart item. Because if your feature not contains moved webpart item then you can see latest webpart in your SP. So you have to add in feature.
Manoj | SharePoint -
Client Object Model in Visual Webpart
Hi
I am new to Client Object Model.I've to create a visual web part in SharePoint 2013 via Client Object Model using
SandBoxed solution.
i did following.
1-Created empty sharepoint project
2-added two dlls for Client Object Model in the project
Microsoft.SharePoint.Client
Microsoft.SharePoint.Client.Runtime
3-in the visual webpart .ascx file i just created asp label as below
<asp:Label ID="label1" runat="server"></asp:Label>
4- in the visual webpart .cs file i write a client object model code to show title items in the label from the "Test" list as below.
5-when i deploy the code it deploys successfully,but when i try to insert this web-part on to the page it shows errors
as below.
Please tell me what am i doing wrong.Urgent help required.Yes,deployed as sandbox solution.Actually i want to create a visual webpart in Sharepoint 2013 using Client Object Model. How can i do this,i followed below steps.
1-Created empty sharepoint project
2-added two dlls for Client Object Model in the project
Microsoft.SharePoint.Client
Microsoft.SharePoint.Client.Runtime
3-in the visual webpart .ascx file i just created asp label as below
<asp:Label ID="label1" runat="server"></asp:Label>
4- in the visual webpart .cs file i write a client object model code to show title items in the label from the "Test" list as below.
using Microsoft.SharePoint.Client;
using System;
using System.ComponentModel;
using System.Web.UI.WebControls.WebParts;
namespace SharePointProject2.VisualWebPart1
[ToolboxItemAttribute(false)]
public partial class VisualWebPart1 : WebPart
// Uncomment the following SecurityPermission attribute only when doing Performance Profiling on a farm solution
// using the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
// for production. Because the SecurityPermission attribute bypasses the security check for callers of
// your constructor, it's not recommended for production purposes.
// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
public VisualWebPart1()
protected override void OnInit(EventArgs e)
base.OnInit(e);
InitializeControl();
protected void Page_Load(object sender, EventArgs e)
ClientContext context = new ClientContext("http://spsiteURL");
List testList = context.Web.Lists.GetByTitle("Test");
CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
ListItemCollection items = testList.GetItems(query);
context.Load(items);
context.ExecuteQuery();
foreach (ListItem listItem in items)
label1.Text = label1.Text + ", " + listItem["Title"];
If this is not the correct way then how can i use client object model to get sharepoint list items.Please mention. -
Sharepoint 2010 Custom Visual Webpart button click event firing on page refresh
I have developed a Visual Webpart to create a list in SP using vs2010 and the button click event I have written the list create method. If I click the button list is created successfully. And I refresh the page again list is creating(Again button
click event is triggering).please help me to solve the issue.
protected void Button1_Click(object sender,
EventArgs e)
SPWeb web
= SPContext.Current.Web;
//SPList list=web.Lists["Auto"];
SPList list
= web.Lists[DropDownList2.SelectedItem.Text];
if
(string.IsNullOrEmpty(TextBox1.Text)
|| string.IsNullOrEmpty(DropDownList1.Text))
Label4.Text =
"Fields Are Empty";
else
if (DropDownList1.SelectedItem.Text
== "Single line of Text")
list.Fields.Add(TextBox1.Text,
SPFieldType.Text,
true);
SPView viewname = list.Views["All Items"];
viewname.ViewFields.Add(TextBox1.Text);
//viewname.Update();
list.Update();
Label4.Text =
"Field Created Successfully";
TextBox1.Text =
string.Empty;
// Label4.Text = string.Empty;Hi,
This is because the request is sent to the server when you refresh the page.
A workaround for this is that we can “provide a refresh link that redirects to the same page (or if you have some action causing the refresh programmatically, you could just
redirect to the page after that, with Response.Redirect)
so that page is requested by the browser (with GET method, default with hyperlinks)”.
More information:
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/45648b39-1229-405c-ac9e-60eb82905982/click-event-getting-fired-on-page-refresh
Or we can use the Session to save a value which used as a flag for us to check whether it is a page refresh and perform accordingly.
http://www.codeproject.com/Articles/28099/Refresh-Page-Issue-in-ASP-Net
http://www.codeproject.com/Articles/10240/Detecting-Page-Refresh
Thanks
Patrick Liang
TechNet Community Support -
How to send timer job email to "assigned to" feild value in a task list?
Hi All,
How to send timer job email to "assigned to" field value in a task list if due date is after two days from now?Create a SharePoint Designer Workflow and use "pause until date" option when an new item is created/update.
Using Server Object model, I believe you can create the timer job from item event receiver.
--Cheers -
How to send meeting invites using Exchange Email Account
Does anybody know how to send meeting invitations using the 3.0 software update?
My corporate email is set up with an Exchange ActiveSync account, but I can't figure out how to send meeting invites?
Is it a function solely of the iPhone 3.0 OS, or is it dependent on the Exchange setup.
Any insight would be appreciated.
DavidThat is what I was afraid of...the good thing is that is the only feature (besides battery life) that I miss from my Blackberry. Thanks.
-
SharePoint DatePicker is not working in Visual webpart
Hi,
The sharepoint date picker is not working for Visual webparts created in VS 2012 (SP 2013).
In my visual webpart, I added the form digest, and then the sharePoint date control.
<script type="text/javascript" src="/_layouts/15/datepicker.js"></script>
<SharePoint:DateTimeControl ID="dtDate" runat="server" DateOnly="true" />
I get the "/ error in Application". Many websites are saying to add the below line to the datepicker:
<SharePoint:DateTimeControl ID="dtDate" runat="server"
DateOnly="true" DatePickerFrameUrl="<%
$SPUrl:~sitecollection/_layouts/15/iframe.aspx %>" />
But adding the "DatePickerFrameUrl" gives error in the "InitializeControl()" method available in OnInit().
Error: The name InitializeControl does not exist in the current context.
I have checked this:
http://developmentsimplyput.blogspot.in/2013/04/sharepoint-datetimecontrol-issue-when.html
http://sharepoint.stackexchange.com/questions/57092/sharepointdatetimecontrol-crashes-in-sp2013-webpart
but did not solve the issue. Also creating a root site for just a DatePicker control is not an option for me.
Has anybody found a solution to this?
How to use the SharePoint datepicker in visual webpart for SP 2013?
Thankshi
did you try to investigate the initial error more deeply, e.g. check stack trace in the logs? In our case it worked quite straightforward (but it was in SP2010) by adding the following control on ascx control:
<SharePoint:DateTimeControl ID="Foo" OnDateChanged="StartTimeChanged" HoursMode24="true" FirstDayOfWeek="1" AutoPostBack="true" runat="server" />
If it is problematic to check logs, you may create custom control which inherits OTB DateTimeControl, override appropriate methods in it and then check the error in debugger:
public class MyDateTimeControl : DateTimeControl
Blog - http://sadomovalex.blogspot.com
Dynamic CAML queries via C# - http://camlex.codeplex.com -
In solman 4.0 how to send message to SAP through service desk
Dear all,
I have configured service desk functionality, My requirement is from service desk how to send message to SAP.
Regards,
Pavan.Hi,
Following the steps:
ƒBasic configuration - RFC Connections to SAP
Check if the RFC Connectino SAPOSS is working properly
Check if load distribution group is set to EWA
The RFC Connections:
- SAP-OSS (Send Message to SAP)
- SAP-OSS-LIST-O01 (Update Message from SAP)
will be created automatically by the system with a user which has been assigned
previously.
IMG Path: SAP Web Application Server | SAP Web Application Server | SAP Solution Manager| Basic Settings | SAP Solution Manager System | Connection to SAP | Assign user for forwarding Service Desk Message
With transaction SM59 you can adjust the RFC connections.
- For further information on SAP R/3 Front-end connections, see SAP Notes: 33135, 766505, 24177
- To forward Service Desk notifications and Issues to SAP, you need to assign a user to the SAPNet R/3
Front-end connection to SAP.
Activities:
- 1. From the SAP Solution Manager (transaction SOLUTION_MANAGER), choose (Edit-> Global Settings.
- 2. Choose Display<->Change.
- 3. For SAP Service Marketplace, specify http://service.sap.com as the URL.
- 4. In the Connection to SAP tab, specify SAPOSS as the RFC destination. Note that the entry is casesensitive.
- 5. For User forwading messages, enter a valid user and a password. This user will require all the authorizations for SAPNet R/3 Front-end for your customer number.
- 6. Save your changes.
The system automatically generates the following RFC destinations and assigns the S-User and password you specified: SAP-OSS, SAP-OSS-LIST-O01
Good Lucky! -
How to send attachments using java application and outlook
Hi ,
I created an application in java which is as
on the Conference Tab i can schedule a conference and with the send command on page it map all the scheduled data to outlook(with all conference details) and using outlook send option the mails are send to appropriate user.
but now i want to modify this application such as when i use the send command from my jsp page it should attach the file that is in .vcs or .ics format for auto updation of user calender.
can any one know how to send attachment using java application .Last time I checked, SMS was a service between carriers and doing SMS yourself was really tricky. Some services existed to let you do it but as I recall they wanted non-trivial money.
However, most phone carriers provide an email-to-SMS bridge of some kind.
So the easiest thing is just to send an email.
That's sending from a non-phone to a phone. There's a J2ME library to send/receive SMS from/to a phone.
However, this is from memory, and a little out of date, so I could be entirely wrong. Hope it helps anyway.
Maybe you are looking for
-
How do I get saved and combined files to display in linear format?
Have been savingng receipts in adobe Acrobat Pro.They would Show up in split form and I could search them. Now when I create a binder of saved receipts they do not format as before. Don't know how to describe what I am talking about so included a pic
-
PDF does not display correctly
Issue: One of our website page displays a PDF form filled with data retrieved from database. The PDF file displays perfect in IE browser, but the PDF form was blank in Firefox browser - can not see the filled data at all in Firefox browser nor in pri
-
1.2.3 - bugs within iOS 8
(iPhone 5S 64 GB) My current list of bugs are: 1. Notifications freezing once touched, especially whatsapp but it happens sporadically, I would have to press the home button for the notification to slide back up. 2. Does not mirror properly with Appl
-
Sending duplicate text messages
My phone is sending duplicate text messages whenever I send to my contacts. How do I stop this? I've noticed this on my RAZR Maxx and now my HTC One M8.
-
Greetings, Is it possible to implement Predefined and Flexible Appraisal Process in the same client? Please provide additional inputs on Yes/No. For annual appraisals we would like to use Predefined and for rest of processes (Surveys etc) would like