function AmountChanged(sender, args) {
if (args._oldValue != '') {
CalculateGridLineTotals();
ReCalculateTaxes();
}
console.log("Row Number " + rowIndex1)
SaveInvoiceItems();
}
function SaveInvoiceItems() {
var masterTable = $find("<%=grdInvoiceItems.ClientID%>").get_masterTableView();
//for (var row = 0; row < masterTable.get_dataItems().length; row++) {
var Id = masterTable.getCellByColumnUniqueName(masterTable.get_dataItems()[rowIndex1], "Id");
var grid = $find("<%=grdInvoiceItems.ClientID%>");
var masterTbl = grid.get_masterTableView();
var gridRow = masterTbl.get_dataItems()[rowIndex1];
var item = gridRow.findControl("ddlItems")._text;
var description = gridRow.findControl("txtDescription")._text;
var price = gridRow.findControl("txtPrice")._text;
var qty = gridRow.findControl("txtQty")._text;
var discount = gridRow.findControl("txtDiscount")._text;
var amount = gridRow.findControl("lblAmount")._text;
if (discount == '')
discount = 0;
if (price == '')
price = 0;
if (qty == '')
qty = 0;
if (amount == '')
amount = 0;
var obj_as_object = { id: Id.innerHTML, item: item, description: description, price: price, qty: qty, discount: discount, amount: amount };;
var obj_as_string = JSON.stringify(obj_as_object);
var xhr = $.ajax({
type: "POST",
url: "/WebService/InvoiceWebService.asmx/UpdateRecurringInvoiceItems",
data: obj_as_string,
'async': false,
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function (xhr, settings) {
xhr.startTime = new Date().getTime();
$("#wait").css("display", "block");
},
complete: function (xhr) {
var elapsed = new Date().getTime() - xhr.startTime;
if (elapsed < 3000) {
$("#wait").css("display", "block").delay(7000 - elapsed).hide(1);
} else {
$("#wait").css("display", "block").hide();
}
}
});
//)).then(function (data, textStatus, jqXHR) {
// //alert("what is this"); // Alerts 200
//});
//setTimeout(doSomething(Id.innerHTML), 3000);
//}
}
When using a template for group headers, how does one catch the events (server side) triggered by a control therein?
basically I want to be able to click a groupheader and call a procedure to open radwindow. This is easy to do on grid rows, but haven't found a way to do in group headers other than to add a control to it. There seems to be two ways, programmatically add all controls (no template) or define a control(s) in a groupheader template. However I can't seem to trap the events when using a template.
Is there a method I am over looking or Is there a way to add a eventhandler after the control is created? Thanks.
<
ItemTemplate
>
<
asp:Label
ID
=
"lblComments"
runat
=
"server"
Text='<%#Server.HtmlDecode(Eval("Comments").ToString())%>' />
</
ItemTemplate
>
protected
void rgProjects_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridPagerItem)
{
var dropDown = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
var totalCount = ((GridPagerItem)e.Item).Paging.DataSourceCount;
bool ALLSelected = (dropDown.SelectedItem.Text == "ALL") ? true : false;
var sizes = new Dictionary<string, string>()
{
{
"50", "50"},
{
"100", "100"},
{
"200", "200"}
};
sizes.Add(
"All", totalCount.ToString());
dropDown.Items.Clear();
foreach (var size in sizes)
{
var cboItem = new RadComboBoxItem()
{
Text = size.Key,
Value = size.Value
};
cboItem.Attributes.Add(
"ownerTableViewId", e.Item.OwnerTableView.ClientID);
dropDown.Items.Add(cboItem);
}
try
{
if (ALLSelected)
dropDown.FindItemByValue(totalCount.ToString()).Selected =
true;
else
{
RadComboBoxItem item = dropDown.FindItemByValue(rgProjects.PageSize.ToString());
if (item != null) item.Selected = true;
}
}
catch (Exception ex)
{
ShowValidationMessage(ex.Message);
}
}
}
<
telerik:radautocompletebox
ID
=
"rdSearch"
runat
=
"server"
EmptyMessage
=
"Type Last Name First Name"
EnableAutoComplete
=
"true"
MinFilterLength
=
"2"
MaxResultCount
=
"20"
Width
=
"260px"
DropDownHeight
=
"100px"
DropDownWidth
=
"250px"
DropDownPosition
=
"static"
AutoPostBack
=
"true"
OnClientEntryAdded
=
"requesting"
>
<
TextSettings
SelectionMode
=
"Single"
/>
<
WebServiceSettings
Path
=
"../AutoComplete.asmx"
Method
=
"GetNames"
/>
</
telerik:radautocompletebox
>
function requesting(sender, eventArgs) {
var context = eventArgs.get_context();
//Data passed to the service.
// context["ClientData"] = "ClientData_Passed_To_The_Service";
}
[WebMethod]
public AutoCompleteBoxData GetNames(RadAutoCompleteContext context)
{
string sql = "select intPersonnelId, strFullname FullName FROM tblMNNatPersonnel WHERE strFullname like '" + context.Text + "%'";
//SqlDataAdapter adapter = new SqlDataAdapter(sql, ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
DataTable myDataTable = new DataTable();
myDataTable = c.GetReader(sql);
List<
AutoCompleteBoxItemData
> result = new List<
AutoCompleteBoxItemData
>();
AutoCompleteBoxData dropDownData = new AutoCompleteBoxData();
result = new List<
AutoCompleteBoxItemData
>();
for (int i = 0; i < myDataTable.Rows.Count; i++)
{
AutoCompleteBoxItemData itemData = new AutoCompleteBoxItemData();
itemData.Text = myDataTable.Rows[i]["FullName"].ToString();
itemData.Value = myDataTable.Rows[i]["intPersonnelId"].ToString();
result.Add(itemData);
}
dropDownData.Items = result.ToArray();
return dropDownData;
}
When it returns to the autocomplete box I need to do take the intPersonnelId and hit a database and return more information.