Hello everyone,
I am working on Accordion. I want to change the headers' backgrounds to different colors when it expends and collapses.
At the first load, every panel is expended, I check and see an expended header's style is controlled by these classes: "k-link k-header k-state-selected" (background color is green).
When I click to collapse this panel, I see the header's style is controlled by these class: "k-link k-header k-state-selected k-state-focused" (the background color is green, too).
I then assign a different background color to "k-state-focused" and the color is changed to gray as I expect. However, when I click on this header again to expend the panel, the gray color is still here! and I check and see this header's style right now (expending) are "k-link k-header k-state-selected k-state-focused".
That means when it is expended or it is collapsed, the header's style is the same "k-link k-header k-state-selected k-state-focused".
How to change the background colors of Collapse and Expend Headers?
Please give a hand, Thanks

protected void rgContracts_ExcelExportCellFormatting(object sender, ExcelExportCellFormattingEventArgs e) { try { GridDataItem item = e.Cell.Parent as GridDataItem; if (e.FormattedColumn.UniqueName == "ContractNo") e.Cell.Style["Horizontal-Align"] = "Right"; if (item.ItemType == GridItemType.Item) item.Style["Horizontal-Align"] = "Left"; if (item.ItemType == GridItemType.Header) e.Cell.Style["Horizontal-Align"] = "Right"; } catch (Exception ex) { XITingExceptionProcessor.ProcessException(this, ex); } }protected void btnReport_Click(object sender, EventArgs e) { try { foreach (GridColumn item in rgContracts.MasterTableView.Columns) { if ((item.UniqueName == "TemplateColumn_Select")) item.Visible = false; if(item.UniqueName=="Details") item.Visible=false; } rgContracts.AllowSorting = false; rgContracts.AllowFilteringByColumn = false; rgContracts.ExportSettings.IgnorePaging = true; rgContracts.ExportSettings.OpenInNewWindow = true; rgContracts.ExportSettings.ExportOnlyData = true; rgContracts.MasterTableView.ExportToExcel(); } catch (Exception ex) { XITingExceptionProcessor.ProcessException(this, ex); } }
Hello,
I am using a "Combined" filter type on a RadGrid and some of my columns use the CheckList filter like the one shown below.
<telerik:GridBoundColumn DataField="State" HeaderText="State" ReadOnly="true" HeaderStyle-Width="40px" FilterControlWidth="40px" ItemStyle-Width="40px" AutoPostBackOnFilter="true" UniqueName="State" SortExpression="State" FilterCheckListEnableLoadOnDemand="false" FilterControlAltText="Filter State column" CurrentFilterFunction="StartsWith"/>We are using a persistence manager to restore the state of the grid, sometimes this includes values that were checked in the column above. When restoring from the persistence manager, the grid is filtered correctly however, the values are not checked in the FilterCheckList.
I tried checking the values in the DataBound event handler for the list box and the values get selected correctly but not checked correctly.
private void ListBox_DataBound(object sender, EventArgs e){ RadListBox listBox = sender as RadListBox; string filter = grdOpportunities.MasterTableView.FilterExpression; filter = filter.Replace("AND", "&"); string[] filters = filter.Split('&'); foreach (string f in filters) { if (f.Contains(listBox.DataKeyField)) { string current = f.Replace("OR", "&"); string[] options = current.Split('&'); foreach (string o in options) { foreach (RadListBoxItem item in listBox.Items) { if (o.Contains(item.DataKey.ToString())) { item.Selected = true; item.Checked = true; } } } } }}Please advise, thank you!
I had to create a table from a MS SQL statement. The table was a product listing whose Items could be added to a shopping cart.
The table creation has to occur in the Page Init event. You should read elsewhere as to why this is a requirement.
Imports Telerik.Web.UIImports System.Data.SqlClientPrivate Sub wfTelerikGrid_Init(sender As Object, e As EventArgs) Handles Me.Init DefineGridStructure()End SubPrivate Sub DefineGridStructure() Dim grid As New RadGrid() grid.ID = "RadGrid1" Dim CoConn As New System.Data.SqlClient.SqlConnection Dim ParmString As String = String.Empty CoConn.ConnectionString = PublicVariables.WSConnInfoStringP ParmString = "SELECT IDNo, ItemNo, ItemDesc, Points, '' as Qty FROM WSProductDtl where WSProductIDNo = 5 " ' Dim dataadapter As New SqlDataAdapter(ParmString, CoConn) dataadapter.SelectCommand.Parameters.Clear() dataadapter.SelectCommand.Parameters.AddWithValue("@IDNo", 5) 'dataadapter.SelectCommand.Parameters.AddWithValue("@Line_No", LineNoInteger) 'dataadapter.SelectCommand.Parameters.AddWithValue("@userID", Environment.MachineName.ToString.Trim.ToUpper & "\" & Main.GetUserName) Dim dt As New DataTable ' CoConn.Open() dataadapter.Fill(dt) CoConn.Close() CoConn.Dispose() ' grid.DataSource = dt 'grid.DataSourceID = "SqlDataSource1" 'grid.Skin = "Vista" grid.Width = Unit.Percentage(100) grid.PageSize = 15 grid.AllowPaging = True grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric grid.AutoGenerateColumns = False 'Add Customers table grid.MasterTableView.Width = Unit.Percentage(50) grid.MasterTableView.DataKeyNames = New String() {"IDNo"} Dim boundColumn As New GridBoundColumn() boundColumn.DataField = "IDNo" boundColumn.HeaderText = "WSProductDtl IDNo" boundColumn.Visible = False grid.MasterTableView.Columns.Add(boundColumn) boundColumn = New GridBoundColumn() boundColumn.DataField = "ItemNo" boundColumn.HeaderText = "Item No" boundColumn.HeaderStyle.Width = Unit.Percentage(20) boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left grid.MasterTableView.Columns.Add(boundColumn) boundColumn = New GridBoundColumn boundColumn.DataField = "ItemDesc" boundColumn.HeaderText = "Item Description" boundColumn.HeaderStyle.Width = Unit.Percentage(50) boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left grid.MasterTableView.Columns.Add(boundColumn) boundColumn = New GridBoundColumn boundColumn.DataField = "Points" boundColumn.HeaderText = "Points" boundColumn.HeaderStyle.Width = Unit.Percentage(15) boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Right boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Right grid.MasterTableView.Columns.Add(boundColumn) Dim templateColumnName As String = "Quantity" Dim templateColumn As New GridTemplateColumn() templateColumn.ItemTemplate = New MyTemplate(templateColumnName) templateColumn.HeaderText = templateColumnName templateColumn.HeaderStyle.Width = Unit.Percentage(15) templateColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Right templateColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Right grid.MasterTableView.Columns.Add(templateColumn) ' Add the grid to the placeholder Me.PlaceHolder1.Controls.Add(grid) End SubPrivate Class MyTemplate Implements ITemplate Protected textBox As TextBox Private colname As String Public Sub New(ByVal cName As String) colname = cName End Sub Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn textBox = New TextBox() textBox.ID = "QtyTextBox" container.Controls.Add(textBox) End SubEnd ClassOne the table was created, I needed to step through the rows and read various cell values. Below is the code to do that.
Private Sub SubmitButton_Click(sender As Object, e As EventArgs) Handles SubmitButton.Click Dim RadGrid1 As RadGrid = CType(PlaceHolder1.FindControl("RadGrid1"), RadGrid) If Not (RadGrid1 Is Nothing) Then For Each item As GridDataItem In RadGrid1.MasterTableView.Items Dim QtyTextBox As TextBox = item.FindControl("QtyTextBox") Dim QtyString As String = QtyTextBox.Text Dim cell As TableCell = DirectCast(item("ItemNo"), TableCell) Dim ItemNoString As String = cell.Text Dim WSProductIDNoString As String = item.GetDataKeyValue("IDNo").ToString() ' Next End IfEnd SubPerhaps I should have added a Add to Cart button on every row. Since I didn't know how to do that I elected to use the single submit button.
I had a difficult time piecing this code together. I wanted to post it so it would be available in a single place. If there are more efficient ways of accomplishing this task, please feel free to comment.

Hello,
I'm having a problem but I actually don't know if it is really a problem or if it is normal behavior.
Let's consider this:
I have a form that loads data from DB. I check IsPostBack before loading data soi dont load everything when changing the values on some controls.
When I save (a button click, and a postback) the data is all saved, and that postback didnt pass the load method, so no DB access on that life cycle part.
I guess it is ok, right?
The problem is when:
- Before i'm validating data then i ask the user something. If he confirms, then I send the .ajaxrequest() (client-side method from the AjaxManager I put on the page) and this goes for the Load method of the life cycle, and in the method, the IsPostback is false, so it access the DB.
The strange thing is:
Lets say on the first load (from DB) the name field was "Rob".
I changed it to "Berta" then tried saving
I was asked something then confirmed.
It entered the DB loading and brought me "Rob"
but then when the saving continued (I'm calling it from the ajaxManager serverside event that catches the client ajaxrequest method) it is "Bertha" that I entered.
I don't know if it is normal behavior or if I'm doing wrong for checking the IsPostback property. I'm kinda new to this ajax thing and this is making me a little confused.
Thanks in advance for any help

Hi
I wana to bind Radgrid to web service with paging server side (linq) , so How do i implement it ?


We've just noticed a problem with the DropDownList in the Chrome Browser on Android devices (might effect other version).
When the web page is zoomed the position of the Drop Down moves out of alignment. The greater the zoom level the more it is out of alignment.
I've attached 2 screen shots:
We are using the latest version of ASP.NET Ajax controls: 2015.3.1111
Let me know if you would like any further information.
Thanks,
Rob

I have a RadRating element for each row in a RadGrid, and need to get the associated Id for the row where the RadRating is being Rated (but with Javascript), however, the get_parent() method is returning the grid reference and not the row.
How can I get the GridDataItem of the row of the RadRating?
The following code works sometimes but not all the time. What am I doing wrong?
<script type="text/javascript"> (function(global,undefined) { function OnClientRating(controlRating,args) { var row = controlRating.get_parent(); var userId = row.getDataKeyValue("UserId"); } global.OnClientRating = OnClientRating; })(window);</script><rad:RadGrid runat="server" ID="gridUsers" Skin="Hay" EnableAJAX="False" AutoGenerateColumns="False" GridLines="Both" Width="100%" AllowSorting="True" OnItemDataBound="Grid_ItemDataBound"> <MasterTableView DataKeyNames="UserId" ClientDataKeyNames="UserId"> <Columns> <rad:GridTemplateColumn HeaderText="Name" HeaderStyle-Width="180px" ItemStyle-Width="180px"> <ItemTemplate> <%# Eval("FullName")%> </ItemTemplate> </rad:GridTemplateColumn> <rad:GridTemplateColumn HeaderText="Rating" HeaderStyle-Width="100px" ItemStyle-Width="100px"> <ItemTemplate> <rad:RadRating ID="ratAppraiserRating" runat="server" ItemCount="5" Value='<%# Eval("AverageRating")%>' SelectionMode="Continuous" Precision="Item" Orientation="Horizontal" OnClientRating="OnClientRating" OnRate="RatRating_Rate" AutoPostBack="true" /> </ItemTemplate> </rad:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings> <Scrolling UseStaticHeaders="false" ScrollHeight="240px" AllowScroll="true" /> <Selecting AllowRowSelect="false" /> <ClientEvents OnRowDblClick="selectRow" /> </ClientSettings></rad:RadGrid>
<telerik:RadTabStrip ID="radESGRTab" runat="server" Orientation="HorizontalTop" MultiPageID="radPageMulti" ClickSelectedTab="true" Skin="Web20" Font-Bold="true" Font-Size="Large" Width="800px" OnClientMouseOver="tabEmployer" OnClientTabSelected="CheckValidation"> <Tabs> <telerik:RadTab PageViewID="rdPageInfo" Text="Soldier Info" runat="server" SelectedIndex="1"></telerik:RadTab> <telerik:RadTab PageViewID="rdPageEmploy" Text="Employer Info" runat="server" SelectedIndex="2"></telerik:RadTab> <telerik:RadTab PageViewID="rdpageSurvey" Text="Survey Info" SelectedIndex="3"></telerik:RadTab> <telerik:RadTab PageViewID="rdPageAwards" Text="Employer Awards" SelectedIndex="4"></telerik:RadTab> </Tabs> </telerik:RadTabStrip>function CheckValidation() { var tab1 = $find('<%=radESGRTab.ClientID %>').selectedIndex(); if (tab1 == 1) { var combo = $find('<%= ddlSoldCounty.ClientID %>'); var item = combo.get_selectedItem().get_value(); alert(combo.get_selectedItem().get_value()); if (item == 1) { alert('You must pick a county from Drop Down List'); } } } </script>