<ClientEvents OnCommand="RaiseCommand"/>
And we need to get our edited values from/in our client side script .... we already have access to previous values (data values) but do not seem to be able to get the edited values
here is the latest of the test code to try to get this to work ...
function RaiseCommand(sender, args)
{
//retrieve the current commandName and commandArgument
var result = String.format("CommandName: {0}, CommandArgument: {1}", args.get_commandName(), args.get_commandArgument());
if(args.get_commandName() == "Update"){
var grid = sender;
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[args.get_commandArgument()];
var cell = MasterTable.getCellByColumnUniqueName(row, "EndDate");
var dtStart = new Date("<%=ViewState("StartDate").ToString %>");
var dtCompare = new Date();
var popUp = args.get_popUp();
var pArgs = popUp.arguments;
alert(pArgs.EndDate);
if(cell.innerHTML == "" || cell.innerHTML == " "){
dtCompare =
"01/01/1800";
else{
dtCompare = cell.innerHTML;
}
alert(dtStart);
alert(dtCompare);
var newValues=MasterTable.extractValuesFromItem(args.get_commandArgument());
var newValuesSB = new Sys.StringBuilder();
for(var property in newValues)
{
newValuesSB.append(String.format(
"<b>{0}</b> : {1} <br/>", property,newValues[property]));
}
alert(newValuesSB);
if(dtCompare < dtStart){
// confirm
if(!confirm("Setting the End Date as you have will result in this disclosure falling outside of the Annual Review Period. Do you wish to proceed?")) {
args.set_cancel(
true);
}
}
//alert(result);
}
}
Many many thanks in advance!
| <telerik:GridCheckBoxColumn DataField="SendNotification" |
| DataType="System.Boolean" |
| meta:resourcekey="GridCheckBoxColumnResource1" |
| SortExpression="SendNotification" |
| UniqueName="SendNotification"> |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridTemplateColumn DataField="NotificationAddress" |
| meta:resourcekey="GridTemplateColumnResource11" |
| SortExpression="NotificationAddress" UniqueName="NotificationAddress"> |
| <EditItemTemplate> |
| <asp:TextBox ID="NotificationAddressTextBox" runat="server" |
| CausesValidation="True" |
| meta:resourcekey="NotificationAddressTextBoxResource1" |
| Text='<%# Bind("NotificationAddress") %>' MaxLength="1024"> |
| </asp:TextBox> |
| <asp:RegularExpressionValidator ID="NotificationAddressTextBoxValidator" |
| runat="server" ControlToValidate="NotificationAddressTextBox" |
| CssClass="ValidationError" Display="Dynamic" |
| ErrorMessage="Invalid e-mail address" |
| meta:resourcekey="NotificationAddressTextBoxValidatorResource1" |
| ValidationExpression="..."> |
| </asp:RegularExpressionValidator> |
| <asp:CustomValidator runat="server" ID="SendNotificationToValidator" |
| EnableClientScript="true" |
| ControlToValidate="NotificationAddressTextBox" |
| ClientValidationFunction="CheckEmailRequired" |
| Display="Dynamic" ErrorMessage="e-mail address required." |
| ValidateEmptyText="true" /> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <%# Eval("NotificationAddress") %> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| function CheckEmailRequired(source, args) { |
| var grid = $find("<%=AlertConfigurationRadGrid.ClientID %>"); |
| var MasterTable = grid.get_masterTableView(); |
| // Can I get the row or item from source or args? |
| var selectedRows = MasterTable.get_dataItems(); |
| // Can I ask each row if it is being edited? |
| for (var i = 0; i < selectedRows.length; i++) { |
| var row = selectedRows[i]; |
| var oldSendNotification = row.getDataKeyValue("SendNotification"); |
| var oldNotificationAddress = row.getDataKeyValue("NotificationAddress"); |
| } |
| args.IsValid = true; |
| return; |
| } |
| <telerik:RadGrid id="RadGrid2" runat="server" |
| GridLines="Horizontal" |
| AllowPaging="True" AutoGenerateColumns="False"> |
| <MasterTableView FilterExpression="([ActivityStatus] = 'Vacant') AND ([poststat] = 'Qualifying')" |
| DataKeyNames="Recordid"> |
| <Columns> |
| <telerik:GridBoundColumn DataField="Recordid" DataType="System.Int32" HeaderText="Recordid" Visible="False" |
| ReadOnly="True" SortExpression="Recordid" UniqueName="Recordid"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="PostingNumber" /> |
| <telerik:GridBoundColumn DataField="poststat" /> |
| <telerik:GridBoundColumn DataField="ActivityStatus" /> |
| </Columns> |
| <DetailTables> |
| <telerik:GridTableView Name="IA" FilterExpression="([AppStat] = 'Late')" THIS IS NOT FILTERING!!! |
| Caption="Internal Applicants" DataKeyNames="Applicationid" |
| DataSourceid="AllApps" runat="server"> |
| <ParentTableRelation> |
| <telerik:GridRelationFields DetailKeyField="Apps" MasterKeyField="Recordid" /> |
| </ParentTableRelation> |
| <Columns> |
| <telerik:GridBoundColumn DataField="SenrBalance" HeaderText="Balance" UniqueName="SenrBalance" /> |
| <telerik:GridBoundColumn DataField="PostStat" HeaderText="PostStat" UniqueName="AppStat" /> |
| </Columns> |
| </telerik:GridTableView> |
| </DetailTables> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="AllApps" runat="server" ConnectionString="<%$ ConnectionStrings:PHCJobPostsConn %>" |
| SelectCommand="Applicants" SelectCommandType="StoredProcedure"> |
| <SelectParameters> |
| <asp:SessionParameter Name="Apps" SessionField="PostNum" /> |
| </SelectParameters> |
| </asp:SqlDataSource> |
| Protected Sub RadGrid2_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid2.NeedDataSource |
| RadGrid2.DataSource = functions.dt(String.Format("exec SProc '706680'", Session("empID"))) |
| End Sub |
<%
@ Page Language="VB" AutoEventWireup="false" CodeFile="RadWindow.aspx.vb" Inherits="RadWindow" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%
@ Register Assembly="RadWindow.Net2" Namespace="Telerik.WebControls" TagPrefix="radW" %>
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
<title>Untitled Page</title>
<
script language="javascript" type="text/javascript">
function ShowAddUserPage()
{
window.radopen(
"AccordionAjax.aspx", "ShowAddWindow");
}
</
script>
</
head>
<
body>
<form id="form1" runat="server">
<div>
<a href="" onclick="javascript:ShowAddUserPage();return false;">Test Code</a>
<radW:RadWindowManager ID="RadWindowManager2" VisibleOnPageLoad="false" Behavior="close" runat="server">
<Windows>
<radW:RadWindow OffsetElementId="ShowAddWindow" runat="server" Width="850px" Height="500px" Modal="true" ID="ShowAddWindow"></radW:RadWindow>
</Windows>
</radW:RadWindowManager>
<asp:LinkButton ID="lnkbtnRadOnCloseRefresh" runat="server"></asp:LinkButton>
</div>
</form>
</
body>
</
html>
when i run the above application i am the follwoing error
| protected void dgvUnselect_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| UserSessionContainer usc = USCHelper.GetUserSessionContainer(Session); |
| DataSet items = Product.Product_SelectAll_ByCustomerId_And_ByProductDescription_AsDataSet(usc.Selected_CouponId); |
| this.dgvUnselect.DataSource = items; |
| } |
"ObjectDataSource",because i must get records from method Product.Product_SelectAll_ByCustomerId_And_ByProductDescription_AsDataSet(usc.Selected_CouponId)Situation:
I have multiple-paged Grid control on the page. It showing all positions in cathegory that user selected.
User can search items via search-engine and it shows elements as a list.
When user clicks on element in search-list, I need to refresh Grid and load all elements from cathegory clicked element belongs to.
Also I need to select this element in Grid and there is the problem: I can not find it in Grid.Items collection if this element not on current page.
Do anybody knows how to get all items ( but not only items from currently selected page ) or may be I doing something worng and there is another way should be used?