Skip to content

Instantly share code, notes, and snippets.

View Microsofttechies's full-sized avatar

Venkat G Microsofttechies

View GitHub Profile
@Microsofttechies
Microsofttechies / gist:7092cd736798e2c79f34
Created March 27, 2015 20:18
An object reference is required for the nonstatic field, method, or property
It looks like you are calling a non static property from a static method. You will need to either make the property static, or create an instance of class
static void SetTextboxTextSafe(int result)
{
label1.Text = result.ToString();
}
@Microsofttechies
Microsofttechies / gist:5f1414dff2d31bb643de
Created March 25, 2015 18:22
C# Read xml Attributes
XMl file
<?xml version="1.0" encoding="utf-8" ?>
<Addresses>
<Address key="UK" City="London" Zip="9999"></Address>
<Address Key="US" City="Newyork" Zip="0000"></Address>
</Addresses>
C#
@Microsofttechies
Microsofttechies / gist:994b3b58aecb41fece69
Created March 25, 2015 18:01
XML read all elements using C#
string strFilename = "Videos.xml";
XmlDocument xmlDoc = new XmlDocument();
if (File.Exists(strFilename))
{
XmlTextReader rdrXml = new XmlTextReader(strFilename);
do {
switch (rdrXml.NodeType)
{
@Microsofttechies
Microsofttechies / gist:2c0706c69e98f5e84b13
Created March 24, 2015 21:34
Aras Innovator Action merge AML code
<AML>
<Item type="Part" action="merge" where="[part].item_number='I12112'">
<item_number>I12112</item_number>
<cost>1000</cost>
<name>My test</name>
<description>My Desc</description>
<classification>Assembly</classification>
</Item>
</AML>
@Microsofttechies
Microsofttechies / gist:21450660812d3eda2d14
Last active January 14, 2016 09:14
Aras innovator create an item ApplyAML
//Note for item create use action='add'...for below code -Don't use merge
HttpServerConnection objCon = IomFactory.CreateHttpServerConnection("http://localhost/InnovatorServer/Server/InnovatorServer.aspx", "MyDB", "Admin", "innovator");
Item objItemRes = objCon.Login();
if (objItemRes.isError())
{
throw new Exception("Login Error");
}
Innovator innovator = objItemRes.getInnovator();
////Option 1
@Microsofttechies
Microsofttechies / gist:d5eb04e6201f2177eff2
Last active December 9, 2025 15:24
How to prevent XDocument from adding XML version and encoding information C#
XmlDocument xdoc = new XmlDocument();
TextWriter wwriter = new StreamWriter("c:/a.xml");
//Do your logic to add all tags to xdoc
////with Tag <?xml version="1.0" encoding="utf-8"?>
//xdoc.Save(wwriter);
////without tag- <?xml version="1.0" encoding="utf-8"?>
XmlWriterSettings xws = new XmlWriterSettings { OmitXmlDeclaration = true };
using (XmlWriter xw = XmlWriter.Create(wwriter, xws))
@Microsofttechies
Microsofttechies / gist:8384755ce1d9461672b8
Created January 16, 2015 16:51
Update Manage Metadata Column
public static void SetManagedMetaDataField(string siteUrl,
string listName,
string itemID,
string fieldName,
string term)
{
ClientContext clientContext = new ClientContext(siteUrl);
List list = clientContext.Web.Lists.GetByTitle(listName);
@Microsofttechies
Microsofttechies / gist:7f4ad8817d6346138165
Created October 31, 2014 18:52
jQuery Remove Duplicate Values
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
$(document).ready(function () {
$('.submitButton').click(function (e) {
var startTime = new Date();
var seen = {};
$('ul li').each(function () {
@Microsofttechies
Microsofttechies / gist:d0d5cc04d9b991b15f39
Created September 16, 2014 18:01
slide toggle from right to left and left to right using jquery
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<style>
#toggle
{
width: 900px;
@Microsofttechies
Microsofttechies / gist:472c9086c0941901f8ad
Created September 15, 2014 23:43
jQuery animate right to left
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide demo</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<style>
#toggle {
width: 900px;
height: 30px;