or
protected void ButtonA_Click(object sender, EventArgs e){ string EmailAddress = // How can I get the email address information shown in the ‘txtEmail’ // text box in the Form Template Edit Form }//************************ Homepage.aspx.cs ********************************************************** public static string SetHighlight(string strOrginal, string strNeedle) { Regex regex = new Regex(strNeedle, RegexOptions.IgnoreCase); //return regex.Replace(strOrginal, "<b>" + strNeedle + "</b>"); return regex.Replace(strOrginal, "<font color=red>" + strNeedle + "</font>"); }[WebMethod] public static RadComboBoxData GetAirportNames(RadComboBoxContext context) { //DataTable data = GetData(context.Text); CommonDL CDL = new CommonDL(); DataTable data = CDL.LoadAirports_HomePage(context.Text); RadComboBoxData comboData = new RadComboBoxData(); int itemOffset = context.NumberOfItems; int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count); comboData.EndOfItems = endOffset == data.Rows.Count; List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(endOffset - itemOffset); for (int i = itemOffset; i < endOffset; i++) { RadComboBoxItemData itemData = new RadComboBoxItemData(); itemData.Text = SetHighlight(data.Rows[i]["PortName"].ToString(), context.Text.ToString()); itemData.Value = data.Rows[i]["AirportID"].ToString(); itemData.Attributes.Add("OrginalText", data.Rows[i]["PortName"].ToString()); //itemData.Attributes.Add(data.Rows[i]["PortName"].ToString(), context.Text.ToString()); result.Add(itemData); } comboData.Message = GetStatusMessage(endOffset, data.Rows.Count); comboData.Items = result.ToArray(); return comboData; } //************************ Homepage.aspx ********************************************************** <telerik:RadComboBox Width="160" ID="cmbFromAirportP3" ValidationGroup="P3" class="text-input" AllowCustomText="true" runat="server" DataTextField="PortName" DataValueField="AirportID" EmptyMessage="Select From Airport" Text="" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="false" ChangeTextOnKeyBoardNavigation="false" OnClientDropDownClosing="cmb_Closing" OnClientItemsRequested="cmbOrgName_ClientItemsRequested" OnClientItemsRequesting="cmbOrgName_ClientItemsRequesting" OnClientSelectedIndexChanged="cmbOrgName_ClientSelectedIndexChanged" OnClientBlur="cmb_Blur" > <WebServiceSettings Method="GetAirportNames" Path="HomePage.aspx" /> </telerik:RadComboBox> //************************ Javascript Code ********************************************************** <script type="text/javascript" id="S2"> function cmbOrgName_ClientSelectedIndexChanged(sender, args) { //Get OrginalText and set to the selected item var orginalText = sender.get_selectedItem().get_attributes().getAttribute("OrginalText"); sender.set_text(orginalText); } function cmb_Blur(sender, args) { //Get OrginalText and set to the selected item var orginalText = sender.get_selectedItem().get_attributes().getAttribute("OrginalText"); sender.set_text(orginalText); sender.hideDropDown();// alert('Cmbo lost focus'); } function cmb_Closing(sender, args) { //Get OrginalText and set to the selected item var orginalText = sender.get_selectedItem().get_attributes().getAttribute("OrginalText"); sender.set_text(orginalText); } function cmbOrgName_ClientItemsRequesting(sender, args) { //clear the existing items sender.get_items().clear(); } //If no records returned, collapse the dropdown automatically. function cmbOrgName_ClientItemsRequested(sender, args) { if (sender.get_items().get_count() == 0) { sender.toggleDropDown(); } } </script><telerik:GridBoundColumn UniqueName="Total" DataField="Total" FooterStyle-Font-Bold="true" FooterStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="95px" DataFormatString="{0:N} TL" HeaderText="Tutar" Aggregate="Sum" AutoPostBackOnFilter="false" ShowFilterIcon="true"> <FilterTemplate> <asp:TextBox CssClass="rgFilterBox" Width="20" ID="ToValue" runat="server" Text='<%# endValue %>'></asp:TextBox> <asp:TextBox CssClass="rgFilterBox" Width="20" ID="FromValue" runat="server" Text='<%# startValue %>'></asp:TextBox> <input type="button" class="rgFilter" title="Filtrele" id="btnValueFilter" onclick="DoValueRangeFilter()" value=" " name="btnValueFilter"> <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function DoValueRangeFilter() { var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); var fromval = $.trim($("#<%# ((GridItem)Container).FindControl("FromValue").ClientID %>").val()); var toval = $.trim($("#<%# ((GridItem)Container).FindControl("ToValue").ClientID %>").val()); tableView.filter("Total", fromval + " " + toval, "Between"); } </script> </telerik:RadScriptBlock> </FilterTemplate></telerik:GridBoundColumn>
protected void grd_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.FilterCommandName)
{
Pair filterPair = (Pair)e.CommandArgument;
switch (filterPair.Second.ToString())
{
case "OrderDate":
this.startDate = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("FromDatePicker") as RadDatePicker).SelectedDate;
this.endDate = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("ToDatePicker") as RadDatePicker).SelectedDate;
break;
case "Total":
this.startValue = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("FromValue") as TextBox).Text;
this.endValue = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("ToValue") as TextBox).Text;
break;
default:
break;
}
}
}
protected string startValue
{
set
{
ViewState["strV"] = value;
}
get
{
if (ViewState["strV"] != null)
return (string)ViewState["strV"];
else
return "";
}
}
protected string endValue
{
set
{
ViewState["endV"] = value;
}
get
{
if (ViewState["endV"] != null)
return (string)ViewState["endV"];
else
return "";
}
}
Hi, I've a boundcolumn named total and i want to filter that column having values range between x to y.
i copied codes from demo in this link and modified for myself to decimal range.
thats my issue :
when i fill range textboxes (ex: ToValue=5 and Fromvalue=1) and press filter button
this.startValue has "1 5" and this.endValue has "5".
i changed the order of textboxes and realized that the first textbox always gets the both boxes value with a space between them.
Am i missing something or is this a bug?? using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.Services;using System.IO;using Newtonsoft.Json;public partial class TestInteraceNotes_testNotes1 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } } [WebMethod] public static string afLoadNotes() { Web Service call returns a datatable
return Serialize(dt); } public static string Serialize(object value) { Type type = value.GetType(); Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer(); json.NullValueHandling = NullValueHandling.Ignore; json.ObjectCreationHandling = Newtonsoft.Json.ObjectCreationHandling.Replace; json.MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore; json.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; //if (type == typeof(DataRow)) // json.Converters.Add(new DataRowConverter()); //else if (type == typeof(DataTable)) // json.Converters.Add(new DataTableConverter()); StringWriter sw = new StringWriter(); Newtonsoft.Json.JsonTextWriter writer = new JsonTextWriter(sw); //if (this.FormatJsonOutput) // writer.Formatting = Formatting.Indented; //else // writer.Formatting = Formatting.None; writer.QuoteChar = '"'; json.Serialize(writer, value); string output = sw.ToString(); writer.Close(); sw.Close(); return output; }}