I'm using a FileExplorer that displays image files. When the user selects a file I need to postback to do some logic. So I have the following function wired up to the OnClientItemSelected event.
function OnClientItemSelected(sender, args) |
{ |
var imageSrc = args.get_path(); |
if (imageSrc.match(/\.(gif|jpg|png)$/gi)) |
{ |
var filename = imageSrc.substring(imageSrc.lastIndexOf('/') + 1); |
__doPostBack("rfeCharts", filename); |
} |
} |
After the postback, the file is no longer selected in the control. I've tried reselecting the file on the server side with .InitialPath and on the client side using the following:
function OnClientLoad(oExplorer, args) |
{ |
var hdChartID = $get("<%=hdChartID.ClientID %>"); |
var oGrid = oExplorer.get_grid(); |
var dataRows = oGrid.MasterTableView.get_dataItems(); |
for(var i = 0; i < dataRows.length; i++) |
{ |
if(dataRows[i].get_dataItem()) |
{ |
if(dataRows[i].get_dataItem().Name == hdChartID.value) |
oGrid.MasterTableView.selectItem(oGrid.MasterTableView.get_dataItems()[i].get_element()); |
} |
} |
} |
And these methods both fire the OnClientItemSelected event again which causes an infinite postback loop.
So how can I persist the selected item through a postback? Or is there another suggestion?