I am using Xamarin Studio with C#.
Actually, I create one custom listView and in this listview I'm using one EditText field for getting information from user. And this listview dynamically generate base response of WCF.
This WCF connect with our DB use for getting and retrieve data.
Currently, I'm using below line of code.
for(int i=0 ; i< listAdapter.Count ; i++)
{
View view = listAdapter.GetView(i, null, null);
EditText edittext= (EditText) view.FindViewById(Resource.Id.lbltdApproveQuantity);
string str = edittext.Text;
}
Problem is: I'm getting Old Value not getting latest Value which user entered.
Advance thanks for all experts. Waiting your response.
Related
Ive just started using NonFactors.Grid.Mvc6 -Version 6.2.4. Ive got its basic functionality working and Im able to retrieve data from my serverside code (.net core 5). I want to implement paging but Im only able to get it to page through the dataset ive received on the clientside. For example, Ive returned 5 rows from the database, the grid only allows me to page through those 5 items. I cant find any documentation (or examples) of using ajax calls to retrieve the data in pages (specifying the current page and number of rows). This is of no use in the real world so the grid must be capable of this somehow (hopefully), but there is nothing documented. Has anyone managed to do this ? Id really appreciate some examples, the documentation is pretty poor
I have the same problem, if I want to use the paging from the backend
Code example
.Pageable(pager =>
{
pager.ShowPageSizes = true;
pager.PageSizes = Model.Paging.PageSizes;
pager.PagesToDisplay = Model.Paging.PagesToDisplay;
pager.CurrentPage = Model.Paging.CurrentPage;
pager.RowsPerPage = Model.Paging.RowsPerPage;
pager.TotalRows = Model.Paging.TotalRows;
})
You can set the TotalRows value, but it will be recalculated for the _Pager.cshtml view based on the Rows.
public virtual IQueryable<T> Process(IQueryable<T> items)
{
TotalRows = items.Count();
My workaround, add/modify the following line to the _Grid.cshtml file:
#if (Model.Pager != null)
{
Model.Pager.TotalRows = Model.Pager.PagesToDisplay * Model.Pager.RowsPerPage;
#await Html.PartialAsync(Model.Pager.PartialViewName, Model.Pager)
}
I would like it so my users do not have to type in wifi credentials everytime they are filling out this form on my xamarin.forms app. I'm trying to figure a way where I can store the value that the user last inputted into an entry. Any suggestions?
I thought it could be as easy as storing it to a field if not null but i get an error stating "Only assignment, call, increment, decrement, await, and new obect expresions can be used as a statement"
At the top of my class I have field.
string WifiNamePlaceholder;
Then later in the page I have my entry
if (WifiNamePlaceholder == null)
{
WifiNamePlaceholder = "Enter in your wifi credentials"
}
wifi_name = new Xamarin.Forms.Entry
{
BackgroundColor = Color.White,
Placeholder = WifiNamePlaceholder,
Margin = new Thickness(0, 0, 10, 0),
FontFamily = Fonts.HelveticaNeueBold,
FontSize = labelSize
}
//Attempt to set new value here but get error
//Doing this in hopes it can save their entry for next time.
wifi_name.Placeholder == WifiNamePlaceholder;
If you have any suggestions it would be greatly appreciated! Thank you!
Use Xamarin.Essentials.Preferences or Xamarin.Essentials.SecureStorage. They're easy to use and don't require a bunch of overhead.
Xamarin.Essentials.Preferences.Get("Key", default(string));
Xamarin.Essentials.Preferences.Set("Key", "stringToSave")
Then just set your Entry.Text using the stored value.
See documentation: Xamarin.Essentials.Preferences
Entry.Placeholder is actually only useful for empty Entry's. It's just an informational text that is shown when Entry.Text is empty. So once the user has entered a value you would set Entry.Text the next time the page is shown.
You should really take some time to familiarize yourself with the way data binding works in Xamarin.Forms and MVVM in general.
You could save it in a local database on the user's phone and then fill the placeholder with the value you get from the database
try this link:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/data/databases
Try saving it in the database or in an xml file.
This way you can use it in your whole application.
if you are using api calls then try to save that password in the backend , so that you can fetch the password by calling that api whenever user open the app.
Otherwise just save the password in shared prefernces so that it ll remain save even if the app closed as explained in previous answers.
Background
We have a custom developed installed .WSP on a SharePoint 2007 environment and have been in the process of upgrading to 2010. With the upgrade the custom event trigger no longer worked so trying to update and make it work in 2010. But I am running into one issue. Original developers no longer here and I've been the lucky one to have to figure this one out without much of a background with SP Dev.
Goal
When a new list item is created trigger event. Within event, create a shared folder using Item Name and return url, create a wiki-page using item name and include shared document link and return url to wiki page. Part three is update newly created list item with the New Folder url and Wiki Page URL.
Issue
I've gotten the first two parts working but so far have been unable to update the newly created list item with the new Links. I'm able to get the links. I've tried all the basic stuff for updating the list that I have been able to find online with no luck. Nothing to complicated(or so I think). But code is included below. VS is not installed on the server so unable to run debug mode, I don't have direct access to the server. When you create the item there are no client/user side error. Haven't been able to find a log file that has any, that is if it collects errors if the script were to fail out.
Initiation of the Event
public class CreateWikiAndFolder : Microsoft.SharePoint.SPItemEventReceiver
{
public override void ItemAdded(SPItemEventProperties properties)
{
try
{
//this.DisableEventFiring();
base.EventFiringEnabled = false;
string sUrlOfWikiPage = string.Empty;
string sUrlOfNewFolder = string.Empty;
string sSubsiteRUL = string.Empty;
string sCurrentItemTitle = properties.ListItem["Title"].ToString();
string sWikiListName = "TR Wikis";
string sDocLibName = "Shared Documents";
string sTRListID = "TR Status";
if (sTRListID.ToUpper().Equals(properties.ListTitle.ToString().ToUpper()))
{
//Create the Folder
sUrlOfNewFolder = CreateFolder(properties.ListItem.Web, sDocLibName, sCurrentItemTitle);
//Create the Wiki
string ItemDispFormUrl = String.Concat(properties.ListItem.Web.Url, "/", properties.ListItem.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url, "?ID=", properties.ListItem.ID.ToString());
sUrlOfWikiPage = CreateWiki(properties.ListItem.Web, sWikiListName, sCurrentItemTitle, ItemDispFormUrl, sUrlOfNewFolder);
//Update the current TR Item
//Have tried. properties.ListItem["WikiURL"] = sUrlOfWikiPage + ", " + "Wiki";
SPListItem myListItem = properties.ListItem;
SPFieldUrlValue shareFolderURLValue = new SPFieldUrlValue();
shareFolderURLValue.Description = "Shared Folder";
shareFolderURLValue.Url = sUrlOfNewFolder ;
myListItem["SharedFolder"] = shareFolderURLValue;
//I've tried each one separate and together to no luck
myListItem.UpdateOverwriteVersion();
myListItem.Update();
//properties.ListItem.UpdateOverwriteVersion();
}
base.EventFiringEnabled = true;
}
}
}
Note that this is the last thing needed to be figured out for our upgrade.
Got it working. I did both of these at the same time so I'm not sure if it was the combination of both or only one of the items. But one I removed the myListItem.UpdateOverwriteVersion(); line and surrounded the item updated with web.AllowUnsafeUpdates being set to true before and then back to false afterwards.
Also as a note to others, you need to save the properties.ListItem to its own SPListItem which you then update versus trying to manipulate the values at the properties.ListItem["Attribute"], and then update the properties.ListItem.Update. SharePoint doesn't allow the latter option so you have to save to an independent SPListItem, and then modify and update that one. This might not be the best SharePoint lingo, but that is what needs to be done.
I'm using Kendo grid in Visual Studio 2010 Asp.net & C#. Im new to this platform. I have more than 100 records in that grid.. i want to select all the records in an array.. Am using the following code.. It selects only the first page records. (PageSize: 5 )..
var entityGrid = $("#grdReport").data("kendoGrid");
var d = entityGrid.dataSource.data();
for(var i = 0; i<d.length; i++)
{
var currentDataItem = d[i];
a.push(currentDataItem);
}
appnt = a;
appnt has only 5 records.. So please Help me in this issue... Thanks in Advance.. :-) Be happy..
You should use ServerOperation of the dataSource sorce set to false if using the MVC wrappers.
If using the regular JavaScript declaration you should set the serverPaging of the dataSource to false.
How do you load them? Are they actually loaded in the browser or are you using Server Paging?
If you have actually the data loaded what you do is correct BUT if the data is actually still in the server, you should check the total using:
var entityGrid = $("#grdReport").data("kendoGrid");
console.log("Total length: ", entityGrid.dataSource.total());
BUT you cannot get the data since it is actually not in the browser, you will get it when moving to a different page.
So the question is: how are you defining the DataSource?
Check it here: http://jsfiddle.net/td8Ww/
Hopefully you can help. I am working on a Browser Enabled InfoPath 2010 form that lives in a Document Library on a SharePoint site (2007 and 2010). In this form there is a repeating table with data that needs to be captured for reporting purposes. The solution I have chosen is to use the built in SharePoint lists.asmx Web Service to write the lines in the repeating table to a separate list on the sane SharePoint site, in the same site collection. I used the steps here, http://msdn.microsoft.com/en-us/library/cc162745(v=office.12).aspx, as my baseline.
I have gotten everything set up and working when run directly from the InfoPath form client site. The form opens and, on submit, the rows in the repeating table are written to the SharePoint list without any problems. However, once I deploy the form through Central Admin and test, none of the rows in the repeating table are getting written to the list. There are no errors or anything to indicate a problem with the code, and a boolean field used to indicate whether or not a row has been uploaded is set to true.
My first thought is that there is a problem with the permissions somewhere. Maybe when the service is called from client side it passes my credentials but when run from the server through the Document Library it's using something different? Shouldn't it use the credentials that are used to gain access to the SharePoint (which are also my AD credentials)? Is there a way to specify the use of the current users AD credentials when calling the lists.asmx web service in the code?
Anyway, not really sure where else to go with this. Any searching I do comes up with the same how two documentation on submitting to a SharePoint list in general. Any help would be greatly appreciated. Below is the code I am using to accomplish this.
if (MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:ShippingInformation/my:ShipDate", NamespaceManager).Value != "")
{
// If Ship Date is not blank, upload items in Material used to SP List where ForQuote is False
// Quote Number, RMA Number, Ship Date, Unit S/N,
// Create a WebServiceConnection object for submitting
// to the Lists Web service data connection.
WebServiceConnection wsSubmit =
(WebServiceConnection)this.DataConnections["Material Web Service Submit"];
//Create XPathNodeIterator object for the new Material Lines
XPathNodeIterator MaterialLines = this.MainDataSource.CreateNavigator().Select("/my:myFields/my:RepairQuote/my:QuoteLines/my:QuoteLine", NamespaceManager);
int lineCount = 0;
foreach (XPathNavigator NewLines in MaterialLines)
{
lineCount += 1;
if (NewLines.SelectSingleNode(".//my:ForQuote", NamespaceManager).Value == "false" && NewLines.SelectSingleNode(".//my:LineSubmitted", NamespaceManager).Value == "false")
{
// Set the values in the Add List Item Template
// XML file using the values in the new row.
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/Field[#Name='Title']", NamespaceManager).SetValue(NewLines.SelectSingleNode(".//my:lineItem", NamespaceManager).Value);
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/Field[#Name='RMANumber']", NamespaceManager).SetValue(MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:EntitlementContainer/my:RMANumber", NamespaceManager).Value);
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/Field[#Name='UnitSerialNumber']", NamespaceManager).SetValue(MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:EntitlementContainer/my:serialNumber", NamespaceManager).Value);
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/Field[#Name='ShipDate']", NamespaceManager).SetValue(MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:ShippingInformation/my:ShipDate", NamespaceManager).Value);
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/Field[#Name='OrderType']", NamespaceManager).SetValue(MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:RepairQuote/my:orderType", NamespaceManager).Value);
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/Field[#Name='QuoteNumber']", NamespaceManager).SetValue(MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:RepairQuote/my:quoteNumber", NamespaceManager).Value);
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/Field[#Name='LineQuantity']", NamespaceManager).SetValue(NewLines.SelectSingleNode(".//my:lineQuantity", NamespaceManager).Value);
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/Field[#Name='LineNumber']", NamespaceManager).SetValue(lineCount.ToString());
// Set the value of Cmd attribute to "New".
DataSources["AddListItemTemplate"].CreateNavigator().SelectSingleNode("/Batch/Method/#Cmd", NamespaceManager).SetValue("New");
// Submit the new row.
wsSubmit.Execute();
NewLines.SelectSingleNode(".//my:LineSubmitted", NamespaceManager).SetValue("true");
}
}
}
I'm unsure why the code doesn't work when you deploy and call the lists web service in code. However I would suggest you to try debugging it to get to the root of the problem:
Step by Step – Debug InfoPath 2010 Forms Deployed on SharePoint 2010 Using Visual Studio 2010
Please try this out and step through it to see if it goes through the code as expected.
Well, I am not sure if it is the answer per se, but I believe the problem was related to security on the site. I got around this by using the SharePoint Object Model instead of the web service to create the list items (See http://www.bizsupportonline.net/browserforms/how-to-use-sharepoint-object-model-submit-data-infopath-browser-form-sharepoint-list.htm). With the SharePoint Object Model I am able to use AllowUnsafeUpdates. Also, where it took me quite a bit of time to get the web service set up, including the data connections, CAML file, etc. This way, however, only took a few minutes. Lesson learned, use the SharePoint Object Model if at all possible.
foreach (XPathNavigator NewLines in MaterialLines)
{
lineCount += 1;
if (NewLines.SelectSingleNode(".//my:ForQuote", NamespaceManager).Value == "false" && NewLines.SelectSingleNode(".//my:LineSubmitted", NamespaceManager).Value == "false")
{
using (SPSite site = SPContext.Current.Site)
{
if (site != null)
{
using (SPWeb web = site.OpenWeb())
{
// Turn on AllowUnsafeUpdates on the site
web.AllowUnsafeUpdates = true;
// Update the SharePoint list based on the values
// from the InfoPath form
SPList list = web.GetList("/Lists/InfoPathRtpItems");
if (list != null)
{
SPListItem item = list.Items.Add();
item["Title"] = NewLines.SelectSingleNode(".//my:lineItem", NamespaceManager).Value;
item["RMANumber"] = MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:EntitlementContainer/my:RMANumber", NamespaceManager).Value;
item["UnitSerialNumber"] = MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:EntitlementContainer/my:serialNumber", NamespaceManager).Value;
item["ShipDate"] = MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:ShippingInformation/my:ShipDate", NamespaceManager).Value;
item["OrderType"] = MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:RepairQuote/my:orderType", NamespaceManager).Value;
item["QuoteNumber"] = MainDataSource.CreateNavigator().SelectSingleNode("./my:myFields/my:RepairQuote/my:quoteNumber", NamespaceManager).Value;
item["LineQuantity"] = NewLines.SelectSingleNode(".//my:lineQuantity", NamespaceManager).Value;
item["LineNumber"] = lineCount.ToString();
item.Update();
}
// Turn off AllowUnsafeUpdates on the site
web.AllowUnsafeUpdates = false;
// Close the connection to the site
web.Close();
}
// Close the connection to the site collection
site.Close();
}
}
}