function OnClientShown(oMenu, args) {
var iCount =0;
var deleteMenuItem = oMenu.findItemByValue("Delete");
var radExplorer = $find("<%# radFileExplorer.ClientID %>");
var getGrid = radExplorer.get_grid();
var table = getGrid.get_masterTableView();
var rows = table.get_dataItems();
var downloadFileItem = oMenu.findItemByValue("Download_File");
if (rows.length == 0) {
downloadFileItem.set_enabled(
false);
}
deleteMenuItem.set_enabled(
true);
}
I have grid on my page located in div with id "Lists":
<div id="Lists"> <telerik:RadGrid runat="server" ID="mygrid" <ClientSettings> <ClientEvents OnGridCreated="document_Grid_OnGridCreated" /> </ClientSettings> </telerik:RadGrid> </div> <div id="ParentList"> </div>when grid is created documentGrid variable is set with that grid:
<script type="text/javascript" > var documentGrid = null; function document_Grid_OnGridCreated(sender, args) { documentGrid = sender; } </script>function updateDocumentGrid(){ documentGrid.get_masterTableView().rebind(); }
I had this problem before and never got and answer to it when i submitted a help ticket and now I am back to it becuase I have another case where I need to impliment it in a radgrid and cannot go back to a asp grid. What is happening is that I need a link button or hyperlink button on a radgrid that when they click on it it opens in a new window a page to email personnel. problem is when I do this it forwards the page to the email name or site in this case, need it to stay at grid and open a the email page and pass a variable to it.
<telerik:GridTemplateColumn HeaderText="MAC #">
<ItemTemplate>
<asp:LinkButton ID="lnkEmail" runat="server" CommandName="Email" CommandArgument='<% #Bind("intUserId") %>' text='<% #Bind("strMacNum") %>'
ToolTip="Email the IMO"></asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
Right now its redirecting but i cannot have this, just needs to open the email page in another window while staying on grid page.
If (e.CommandName = "Email") Then
Dim RecordId As Integer = e.CommandArgument
Response.Redirect("Email.aspx?Email=" & RecordId)
End If
also tried this but no go, forwards the grid to email page.
ClientScript.RegisterStartupScript(Me.GetType(), "OpenWin", "<script>openNewWin('" & url & "')</script>")
My Scenario
I have a grid which allows inline editing. When the user clicks a hyperlink in any row I open a radwindow. The hyperlink is a template cell and I open the RadWindow via javascript which all works fine except that I need to be able to save the row before opening the radwindow if it is in edit mode because I'm passing in the unique id of the row and if it is a new row I need to perform the insert command first so that the Id is generated on the server. The data is in SQL and the Id is an Identity column. I'm also using automatic updates on the grid.
My Question
Is it possible to save the row and invoke the insert command when the user clicks the hyperlink/template cell? If so can you provide sample code on how this could be done from javascript or server side code. Both would be idea. Thank you!
Here is the template column used to open the RadWindow
<telerik:GridTemplateColumn HeaderText="Selection Options" UniqueName="SelectionOptions" AllowFiltering="false">
<ItemTemplate><a href="#"
onclick='openAnswerOptionsWindow('<%# DataBinder.Eval(Container.DataItem, "LCFormMetadataId") %>'); return false;'>
SelectionOptions</a></ItemTemplate>
</telerik:GridTemplateColumn>
Here is the javascript I use to open the RadWindow
function openLCFormManagementWindow() {
var oWnd = radopen("LCFormMaintenance.aspx");
oWnd.Center();
}