Friday, February 1, 2013

Fluient nhibernet syntaxes

After a long time working on nhibernet fluient
I like that much with c# syntax
It is really good rather than the normal syntax with xmles

Handlin radio button with value javascript

<script type="text/javascript">
    function Str() {
        var theSelectedRadio = document.getElementsByName("x");       
        for (var i = 0; i < theSelectedRadio.length; i++) {           
            if (theSelectedRadio[i].checked) {
                alert(theSelectedRadio[i].value);
            }
        }       
    }
    </script>

<body>
</body>


<input id="x" type="radio" name="x" value="true" />
    <input id="y" type="radio" name="x" value="false" />
    <input id="z" type="radio" name="x" value="NotSelected" />
    <input type="radio" name="x" value="NotSelectedThere" />
    <input type="button" value="s" onclick="Str()" />

Wednesday, October 17, 2012

Getting deserialized object from the xml string

 public static T DeserializeFromXml<T>(string xml)
        {
            T result;
            XmlSerializer ser = new XmlSerializer(typeof (T));
            using (TextReader tr = new StringReader(xml))
            {
                result = (T) ser.Deserialize(tr);
            }
            return result;
        }