<telerik:RadGrid ID="rgEditOrder" OnNeedDataSource="rgEditOrder_NeedDataSource" OnItemCommand="rgEditOrder_ItemCommand" OnItemUpdated="rgEditOrder_UpdateRow" OnItemCreated="rgEditOrder_OnItemCreated" runat="server"> <GroupingSettings CaseSensitive="false" /> <MasterTableView DataKeyNames="OrderSeq" AutoGenerateColumns="false" AllowSorting="true" AllowPaging="true" AllowFilteringByColumn="False" EditMode="InPlace" > <Columns> <telerik:GridBoundColumn UniqueName="StoreNumber" DataField="StoreNumber" HeaderText="Store #" DataFormatString="{0:#####}" DataType="System.Int32" ReadOnly="True"> <HeaderStyle Width="40px" /> </telerik:GridBoundColumn>a bunch of columns <telerik:GridTemplateColumn UniqueName="Qty" HeaderText="Cases" > <ItemTemplate> <asp:Label ID="lblQty" Text='<%# Bind("Qty") %>' Width="40px" runat="server" /> </ItemTemplate> <EditItemTemplate> <telerik:RadNumericTextBox ID="rntbQty" Text='<%# Eval("Qty") %>' MinValue='<%# Bind("Qty") %>' Width="40px" runat="server"> <NumberFormat DecimalDigits="0" /> </telerik:RadNumericTextBox> </EditItemTemplate> <HeaderStyle Width="40px" /> </telerik:GridTemplateColumn>more columns <telerik:GridBoundColumn UniqueName="OrderSeq" DataField="OrderSeq" DataType="System.Int64" Visible="false"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <ClientSettings EnablePostBackOnRowClick="true" > <ClientEvents OnRowDblClick="RowDblClick" /> </ClientSettings> </telerik:RadGrid><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"><title>Edit Order</title><script language="javascript" type="text/javascript"><!--// this function handles the onbeforeprint event of the body objectfunction window_onbeforeprint(){ // idprint is the id assigned to the div tag of the javascript // injected into the response object in the code behind which // actually prints the screen var divEle = document.getElementById("idPrint"); // remove the display=none i.e. show the div element if (divEle != null) { divEle.style.display = ""; } // hide the div elements idShow.style.display="none"; // idShow.style.display="none"; // idShow1.style.display="none"; idShow1.style.display="none"; idHeader.style.display="none"; }// this function handles the onafterprint event of the body objectfunction window_onafterprint(){ // idprint is the id assigned to the div tag of the javascript // injected into the response object in the code behind which // actually prints the screen var divEle = document.getElementById("idPrint"); // hide the div element if (divEle != null) { divEle.style.display = "none"; } // remove the style.display='none'-show the div element idShow.style.display=""; // idShow1.style.display=""; idShow1.style.display=""; idHeader.style.display="";}var idx = 0;function RowDblClick(sender, eventArgs) { idx = eventArgs.get_itemIndexHierarchical(); sender.get_masterTableView().editItem(idx);}// this function is called on the click event of the Finalize Order button// it is wired to the button in the page load event function check_input() { // both the first and last name need to be entered-if either of them is not // popup message box and cancel update var strName = document.getElementById('txtFirstName'); if (trim(strName.value) == "") { alert("Please Enter First Name"); return (false); } strName = document.getElementById('txtLastName'); if (trim(strName.value) == "") { alert("Please Enter Last Name"); return (false); } return (true);}// use regular expression to format first or last name// per Derek-remove any imbedded white spacefunction trim(str) { return str.replace(/^\s+|\s+$/g, '');}// this functiom was added because the code behind is looking for it function PrintPage() { return true;}--></script></head>protected void rgEditOrder_OnItemCreated(object source, GridItemEventArgs e){ StringBuilder sb; GridEditableItem geItem; TableCell tcQty; RadNumericTextBox rntbQty; char DoubleQuote; string EscapeChar,str; DoubleQuote = (char) 34; sb = new StringBuilder(DoubleQuote); EscapeChar = sb.ToString(); str = DoubleQuote.ToString(); if (e.Item.IsInEditMode) { } else return; if (e.Item is GridEditableItem) { } else return; geItem = (GridEditableItem)(e.Item); sb = new StringBuilder("<script language="); sb.Append(@"'"); sb.Append("javascript"); sb.Append(@"'"); sb.Append(" "); sb.Append(@"'"); sb.Append("text/javascript"); sb.Append(@"'"); sb.Append(">"); sb.Append("function QtyOnValueChanged(sender, eventArgs) { "); sb.Append("alert("); sb.Append(@"'"); sb.Append("gorkomatic"); sb.Append(@"'"); sb.Append("); "); sb.Append("var grid = $find("); sb.Append(@"'"); sb.Append("<%= "); sb.Append("rgEditOrder.ClientID"); sb.Append(" %>"); sb.Append(@"'"); sb.Append(").get_masterTableView(); "); sb.Append("grid.updateItem(grid.get_dataItems()["); sb.Append(geItem.DataSetIndex.ToString()); sb.Append("].get_element()); "); sb.Append("alert("); sb.Append(@"'"); sb.Append("qty on value changed"); sb.Append(@"'"); sb.Append("); }"); sb.Append("</script>"); str = sb.ToString(); rcBlock.Controls.Add(new LiteralControl(str)); // ScriptManager.RegisterStartupScript(this,this.GetType(), "Update", str, false); tcQty = geItem.Cells[1]; rntbQty = (RadNumericTextBox)tcQty.FindControl("rntbQty"); if (rntbQty == null) return; rntbQty.ClientEvents.OnValueChanged = "QtyOnValueChanged";}We have column name Member Name in Data Set and we are using following sql query for getting this name into data set.
Select
COALESCE(
STUFF
(
(
SELECT DISTINCT
''; '' + FirstName + CASE WHEN MI IS NULL THEN '''' ELSE '' '' + MI END + '' '' + LastName
FROM
TestTable1
INNER JOIN TestTable2 on TestTable1.customerid = TestTable2.customerid
WHERE
TestTable2.MemberID = TestTable1.customerid
FOR XML PATH('''')
)
,1,1,''''
),''N/A'') AS [Name]
From TestTable
Based on above query we are getting customer name successfully in data set and bind to grid. Now issue is that we are not able to use Starts with operator and column filter is not returning any result. However when we use “Contains” operator we are able to retrieve correct result.
Also we have another column that simply returns column data as below
Select TestTable.PersonName From TestTable
Using above query we are successfully use starts with operator.
So what can be the problem and how can we resolve it?
Regards,
Dharmesh Solanki
I have a hierarchy grid that is populated on demand (server side) using the NeedDataSource and DetailTableDataBind events (single level detail table) based on your example provided in the documentation.
Everything works fine but I have noticed that if 2 child levels are opened/expanded at the same time the second one does not refresh correctly. When I click to expand to see the details in another row I have correct number of pages but no data in the grid.
If I only have one sub level expanded/opened at the time everything works fine – for example I close/hide the details before I open/expand another row.
What else do I need to do to fix the refresh issue.