Tuesday, June 25, 2013

RadGrid access the control inside command item template in DataBound event

protected void RadGrid1_DataBound(object sender, eventargs e)
{
     GridItem commandItem = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0];
     Button button1 = commandItem.FindControl("button1") as Button;
}

Friday, June 21, 2013

the updated way to open radwindow from server side

string script = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);

Tuesday, June 11, 2013

what if jquery toggle doesn't work?

alternative is to use plain javascript, doesn't behave as nice but it works.

function toggleCourseDescriptions(conditioner) {

            var targetCtrl = document.getElementById("divCourseDescription");
            var triggerControl = document.getElementById("aToggleCourseDescription");


            if (targetCtrl.style.display == 'none') {
                targetCtrl.style.display = null;
            } else {
                targetCtrl.style.display = 'none';
            }

            if (triggerControl.text == "-") {
                triggerControl.text = "+";
            } else {
                triggerControl.text = "-";
            }
        }