Hi,
Yes you can create all functionality which developed in web asp.net grid etc..
For Grid functions use List View, which can be custom designed to view all items in a grid ..
For connecting it to SQL Server write WCF / JSON format service.. and host the service in web server.
Upload Data from Xamarin Android to Remote Server
List listToServer = new List< Student >();
try
{
listToServer.Clear();
new Java.Lang.Thread(() =>
{
listToServer.Add(exCloud);
string jsonstr = JsonConvert.SerializeObject (Student);
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(jsonstr);
string webStr = "http://sampleStudent.com/wcf/ExcelData.svc/json/StudentDetails";
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(webStr);
webrequest.Method = "POST";
webrequest.ContentType = "application/x-www-form-urlencoded";
webrequest.ContentLength = data.Length;
Stream newStream = webrequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding("utf-8");
StreamReader loResponseStream = new StreamReader(webresponse.GetResponseStream(), enc);
string message=loResponseStream.ReadToEnd();
RunOnUiThread(() => onSuccessfulLogincl(message));
}).Start();
}
catch (Exception ex)
{
Toast.MakeText (this, ex.Message, ToastLength.Long).Show ();
}
Sending Data to Server from Android Xamarin
ListgetDataFromServer()
{
List StudentList = new List ();
try
{
WebClient client = new WebClient ();
string webStr;
webStr = "http://sampleStudent.com/wcf/ExcelData.svc/json/students";
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create (webStr);
webrequest.Method = "GET";
webrequest.ContentType = "application/x-www-form-urlencoded";
HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse ();
Encoding enc = System.Text.Encoding.GetEncoding ("utf-8");
StreamReader loResponseStream = new StreamReader (webresponse.GetResponseStream (), enc);
string JsonString = loResponseStream.ReadToEnd ();
StudentList = Deserialise> (JsonString);
webresponse.Close ();
loResponseStream.Close ();
RunOnUiThread (() =>HideProgress () );
}
catch (Exception ex)
{
Toast.MakeText (this,ex.Message, ToastLength.Long).Show ();
}
return StudentList;
}
public static T Deserialise(string json) {
var obj = Activator.CreateInstance();
using (var memoryStream = new MemoryStream(Encoding.Unicode.GetBytes(json))) {
var serializer = new DataContractJsonSerializer(obj.GetType());
obj = (T) serializer.ReadObject(memoryStream);
return obj;
}
}
Thanks,
Ullas Krishnan