Tuesday 20 June 2017

How to rest asp.net control in web form.

Protected void Clear()
{
foreach(Control ctrl in Form.Control)
{
//Text Box Control
if(ctr is TextBox)
{
((TextBox )(ctrl)).Text="";
}
// Label Control
else if(ctrl is Label)
{
((Label)(ctrl)).Text = "";
}
//DropDownList controls
else if(ctrl is DropDownList)
{
((DropDownList)(ctrl)).ClearSelection();
or
((DropDownList)(ctrl)).selectedIndex = 0;  
}
//CheckBox controls
  else if (ctrl is CheckBox)
{
 ((CheckBox)(ctrl)).Checked = false;
}
 //RadioButton controls
  else if (ctrl is RadioButton)
        {
     ((RadioButton)(ctrl)).Checked = false;
            }
}
}

How to get logged in User's Security Roles using Java Script in dynamic CRM 365.

 function GetloggedUser () {     var roles = Xrm.Utility.getGlobalContext().userSettings.roles;      if (roles === null) return false;      ...