Tuesday, May 31, 2011

Read XML Node Value


foreach (XmlNode node1 in nodec.ChildNodes)
            {
                if (node1.Name == "STATUS")
                {
                    for (int i = 0; i < node1.Attributes.Count; i++)
                    {
                        if (node1.Attributes[i].Name == "type")
                        {
                            statustype = node1.Attributes[i].Value;
                        }
                    }
                    foreach (XmlNode node2 in node1.ChildNodes)
                    {
                        if (node2.Name == "subTransId")
                        {
                            subtransId = node2.InnerText;
                        }
                    }
                }
                if (node1.Name == "CONTENT")
                {
                    foreach (XmlNode node2 in node1.ChildNodes)
                    {
                        if (node2.Name == "DECISION")
                        {
                            foreach (XmlNode node3 in node2.ChildNodes)
                            {
                                if (node3.Name == "SCORES")
                                {
                                    foreach (XmlNode node4 in node3.ChildNodes)
                                    {
                                        if (node4.OuterXml.Contains("CLV:INQ"))
                                        {
                                            if (node4.InnerText != "" || node4.InnerText != "0")
                                            {
                                                score = node4.InnerText;
                                            }
                                            else
                                            {
                                                score = "Denied";
                                            }
                                        }
                                    }

                                }

                            }

                        }

                    }
                }
            }

Wednesday, May 25, 2011

Get Child Control on page (Usercontrol textbox in default page)


TextBox txtdrop1 = (TextBox)Multiselectdropdown3.FindControl("tbm");
// Multiselectdropdown3 is the ID of UserControl
// tbm is ID of the textbox available in UserControl.

Get Form value on Postback c#


 System.Text.StringBuilder displayValues =
            new System.Text.StringBuilder();
            System.Collections.Specialized.NameValueCollection
                postedValues = Request.Form;
            String nextKey;
            for (int i = 0; i < postedValues.AllKeys.Length; i++)
            {
                nextKey = postedValues.AllKeys[i];
                if (nextKey.Substring(0, 2) != "__")
                {
                    displayValues.Append("<br>");
                    displayValues.Append(nextKey);
                    displayValues.Append(" = ");
                    displayValues.Append(postedValues[i]);
                }
            }

         

Friday, May 20, 2011

Resize grid on Browser resize


//ctl00_ContentPlaceHolder1_RadGrid_List_GridData .(this is grid ID).
//ctl00_ContentPlaceHolder1_grdview_GridData (second grid id)

<script>
    jQuery(document).ready(function(){
                jQuery(window).resize(function(){
                    var orignalHeight = parseInt($(window).height());
                    var newHeight = (orignalHeight/25)*8;
                    var containterHeight = parseInt($("#ctl00_ContentPlaceHolder1_RadGrid_List_GridData").height());

                    $('#ctl00_ContentPlaceHolder1_RadGrid_List_GridData').css('cssText', 'height: '+newHeight+'px !important');
                    $("#ctl00_ContentPlaceHolder1_RadGrid_List_GridData").css({'overflow':'auto','width':'100%'});
                    //alert($("#ctl00_ContentPlaceHolder1_RadGrid_List_GridData").height());
                  
                    var secContainerHeight=parseInt($("#ctl00_ContentPlaceHolder1_grdview_GridData").height());
                    $('#ctl00_ContentPlaceHolder1_grdview_GridData').css('cssText','height:'+newHeight+'px !important');
                    $("#ctl00_ContentPlaceHolder1_grdview_GridData").css({'overflow':'auto','width':'100%'});
                  
                  
                });
            });
    </script>