Jun 30, 2010

How to find the GridView RowID on SelectedIndexChanged Event of DropDownList inside ItemTemplate of GridView

Once there is a case where i need to bind a dropdownlist depending 
on the selection of other dropdownlist.
The above case is a usual one which we can do in a selectedIndexChanged Event. 
But here the twist is, 
I have both the dropdownlist inside a GridView as ItemTemplate.
So when i write a selectedIndexChanged how do i identify the actual row id of the GridView where the current DropDownList is present.
Here we go for the solution..
Write the below code to the selectedIndexChanged Event of the DropDownList

// First Identify the row in which the dropdown value has been changed
        GridViewRow gr = (GridViewRow)
 //find the control in the current row
        // selected dropdownlist
        DropDownList Projectddl = (DropDownList)gr.FindControl("ddlTest");
        // Dropdownlist to bind
        DropDownList Datumddl = 
        if (Projectddl.SelectedItem.Value == "SomeSelectedValue")
           // bind the second dropdownlist here
          Datumddl .DataSource = dTable;

          Datumddl .DataTextField  = member;
          Datumddl .DataValueField = member;
          Datumddl .DataBind();

Jun 26, 2010

How to find expandedPaneId of Rad Sliding Pane and collapse + Client side

While using more sliding panes in my project , there was a need to expand and collapse panes manually and programatically. 

When doing so, i noticed a problem with Sliding Pane that when we try to expand a pane when already other pane is expanded , there was a mesh. 

Both the panes are expanded but the Close[x] button is not working in the panes.
i.e we are unable to close the pane using the Close[x] button on the pane.

so here we go how to solve this problem?
The solution is " Lets find the expanded pane id for the SlidingZone and collapse it first before opening a new pane. Below is the code.

// finds the Rad sliding zone first in which the pane resides
var slidingZone = $find("SlidingZone1");
 var slidingZone = $find("<%= SlidingZone1.ClientID %>"); // for Master Page Scenerio

// find the expanded pane id of the zone and collapse it
var expandedPaneId = slidingZone.get_expandedPaneId();

 // To collapse the pane 
      slidingZone.collapsePane(expandedPaneId );

After this, one can perform expand collapse pane operations as shown in my previous post without mesh.