Skip to content

Instantly share code, notes, and snippets.

View pwdonald's full-sized avatar

Donald Jones pwdonald

  • EBSCO Information Services
View GitHub Profile
@pwdonald
pwdonald / jquery_ui_popup_helper
Created February 5, 2014 20:02
jQuery UI Popup Message Helper
// PopUpMessage dialog helper
// Requires a div for messagebox and a inner div for inner-message
function PopupMessage(text,title) {
$('.inner-message').text(text);
$('.message-box').dialog(
{
title: title,
modal: true,
buttons: [{ text: "Ok", click: function () { $(this).dialog("close"); } }]
@pwdonald
pwdonald / jquery_child_input_hidereset
Last active August 29, 2015 13:56
jquery_child_input_hidereset
function hideAndResetCollection(containerFormElement) {
var container = "";
if (containerFormElement instanceof jQuery) {
container = $(containerFormElement.selector + ' :input');
} else {
container = $(containerFormElement);
}
$.each(container, function (index, value) {
hideAndReset($(value));
});
@pwdonald
pwdonald / xml_deserializer
Created February 5, 2014 20:18
C# Xml Deserialize to Model
// XML DESERIALIZER
// Used for deserializing XML serialized by the default C# serializer into Models
// that match the XML structure.
public static T XmlDeserializeFromString<T>(string objectData)
{
return (T)XmlDeserializeFromString(objectData, typeof(T), typeof(T).Name);
}
public static object XmlDeserializeFromString(string objectData, Type type, string rootname)
@pwdonald
pwdonald / xml_remove_null_fields
Created February 5, 2014 20:20
C# Remove Null Fields from XML
// XML NULL FIELD REMOVAL
// Removes all Null fields (both with nil=true) from a XmlDoc
public static XmlDocument RemoveNullFields(this XmlDocument xmldoc)
{
XmlNamespaceManager mgr = new XmlNamespaceManager(xmldoc.NameTable);
mgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
XmlNodeList nullFields = xmldoc.SelectNodes("//*[@xsi:nil='true']", mgr);