Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
159 views

I was looking through the forums and pieced together a few things to expand a group when you click the text, not just the little arrow. Just thought I'd share. 

I'm using a group header template b/c I like to customize the text. So here it is, in your template drop this in.

<groupheadertemplate>

<asp:label id="lblGridHeader" runat="server" Text='<%# Eval("someCol") %>' />
</groupheadertemplate>

 

Throw in this JS

<script type="text/javascript">

function toggleGroups(index) {

var gridClientID = '<%= RadGrid1.ClientID %>';
var grid = $find(gridClientID);
var masterTable = grid.get_masterTableView();
var groupToggles = masterTable._element.getElementsByTagName('INPUT');

if (index != null) {
if (index < groupToggles.length)
masterTable._toggleGroupsExpand(masterTable._element.getElementsByTagName('INPUT')[index], event);
}

else {
for (var i = 0; i < groupToggles.length; i++) {
masterTable._toggleGroupsExpand(masterTable._element.getElementsByTagName('INPUT')[i], event);
}
}
}
     
</script>

 Now, this part is so simple it's stupid. Took me a while before I realized how easy it was. Attach an ItemDataBound event to your grid. The, create a variable that's public for the page and initialize it to 0

MAKE SURE that is for the page, and not defined within the itemdatabound event. 

int _groupIndex = 0; //stored for the group index so we can expand/collapes on group row click

 Now, in the item data bound event, just do this. 

protected void gridCreqCat_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridGroupHeaderItem)
{
GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;

//this is an asp label b/c we need to render the <span> tag so we have something to click
Label headLbl = (Label)item.FindControl("lblGridHeader");
headLbl.Attributes.Add("onclick", "toggleGroups(" + _groupIndex.ToString() + ");");
_groupIndex++;
}
}

 

 

Michael
Top achievements
Rank 1
 answered on 18 Jun 2015
2 answers
327 views

Hello,

 

I have created a radgrid with some basic grouping functionality. I have filtering enabled for my ID column, which is also the fieldName value for my grouping. I noticed when I was trying to reduce the filter menu options to have only "no filter and "contains" the "contains" value was missing. I suspected initially that this may have been due to the fact that I was using the grouping feature, but even when I removed the grouping code from the aspx the "contains" filter option never shows up?

 

Am I missing something?

 

<telerik:RadGrid ID="RadGrid1" Skin="Outlook" 
                     ViewStateMode="Enabled" AllowFilteringByColumn="true"
                     OnNeedDataSource="RadGrid1_NeedDataSource" GridLines="Both" runat="server"
                     AutoGenerateColumns="false" AllowPaging="true">
                     <ClientSettings>
                      
                        <Selecting AllowRowSelect="true" />
                        <ClientEvents OnRowSelected="RadGrid1_RowSelected" OnRowDeselected="RadGrid1_RowDeselected" OnRowCreated="RadGrid1_RowCreated" OnGridCreated="RadGrid1_GridCreated"  />
                     </ClientSettings>
                        <MasterTableView DataKeyNames="ID" ClientDataKeyNames="ID" GroupLoadMode="Client" >
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="ID" SortOrder="Descending" />
                        </SortExpressions>
                          <GroupByExpressions >
                            <telerik:GridGroupByExpression >
                                <SelectFields>
                                    <telerik:GridGroupByField  FieldAlias="ID" FieldName="ID" HeaderText="Proposal No" FormatString="{0:D}">
                                    </telerik:GridGroupByField>
                                </SelectFields>
                                 
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="ID" SortOrder="Descending"></telerik:GridGroupByField>
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <Columns>
                            <telerik:GridBoundColumn AllowFiltering="true" DataField="ID" HeaderText="Proposal No." SortExpression="ID"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Revision" AllowFiltering="false"  HeaderText="Revision"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="partnumber" AllowFiltering="false" HeaderText="Part No."></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="quickship" AllowFiltering="false" HeaderText="Quickship No."></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="datequoted" AllowFiltering="false" HeaderText="Date Proposed"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="dateexpires" AllowFiltering="false" HeaderText="Date Expires"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="notes" AllowFiltering="false" HeaderText="Notes"></telerik:GridBoundColumn>
                        </Columns>
                     </MasterTableView>
                 </telerik:RadGrid>     

 

Thanks in advance,

Justin

Justin
Top achievements
Rank 1
 answered on 18 Jun 2015
1 answer
99 views

Hi,

We are trying to upgrade the browser from IE9 to IE11.
We are using VS 2012 and Telerik controls for ASP.NET AJAX version 2013.3.1114.45. 

In IE9, the GridCommandItem is displayed above the GridPagerItem in telerik radgrid.
Where as in IE11, The GridPagerItem is being displayed first and then far below to it GridCommandItem is displayed.
so the GridCommandItem is going beyond the IE window height and is not visible to the users.
The grid height is set to 100%, such that the pager item appears as the last row on the screen above which the command item needs to be shown.

Any idea how to resolve this behavior in IE11 ?

 

Thanks

Bhanu.

 

Konstantin Dikov
Telerik team
 answered on 18 Jun 2015
8 answers
500 views

Hello,

i want to display --/--/---- in my datepicker controls textbox.
i used emptymessage property but once i entered something in my textbox it removed the format --/--/----.

i want that once user enter something it should display like that 12/--/----.

is it possible to display like this?

thanks
Sweta
Eyup
Telerik team
 answered on 18 Jun 2015
1 answer
171 views

HI,

 I am trying to bind a load on demand RadCombobox to a Web API, do we have any sample code for it? I found  following code to bind it to WEB API but it's not load on demand. I want to show how many items are already loaded out of total records and cache items that were loaded earlier.

 Web API Binding:

 http://www.telerik.com/forums/radcombobox-with-webapi-service-as-datasource

I want to maintain functionality under this link for web service binding.

http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx

 

 

Thanks,

Prava

Hristo Valyavicharski
Telerik team
 answered on 18 Jun 2015
3 answers
174 views

Hi

I have some javascript functions that I call in the events of controls (in the code behind) in a RadAjaxPanel and all works fine.  The Javascript functions use the find function to find the controls inside the radAjaxPanel.

I need to call the same js functions from outside the RadAjaxPanel (in other code behind c#) but the js find function fails to find the controls that are inside the RadAjaxPanel.  What have I missed or is it a feature?

Maria Ilieva
Telerik team
 answered on 18 Jun 2015
1 answer
100 views

Hi, 

 I am trying to use the pivot grid.  when I use it out of a master page table it works fine. when I use it within a master page it does not works.

 

Would you like to help me.

 

I tried to update the project but you do not allow it.

 

Thanks in advance

Angel Petrov
Telerik team
 answered on 18 Jun 2015
5 answers
212 views
Hi,
  In my radgrid, I need to use a GridButton column with button type as LinkButton. I enabled filtering with help of http://www.telerik.com/community/code-library/aspnet-ajax/grid/filtering-and-sorting-for-gridbuttoncolumn.aspx. This works fine with the help of the filter icon. My requirement is to hide the filter icon and have the default filtering set and apply filter.

Grid definition:
<custom:GridButtonColumnWithFilteringSorting HeaderText="" UniqueName="LastName"  DataTextFormatString="{0}" 
SortExpression="LastName" DataTextField="LastName" DataField="LastName" ItemStyle-CssClass="myLink"
CommandName="DisplayMember" HeaderButtonType="LinkButton" ButtonType="LinkButton"
CurrentFilterFunction
="StartsWith"  AutoPostBackOnFilter="true"  ShowFilterIcon="false"  />

When I type a filter text and hit ENTER key, I don't see postback happening thereby triggering the filter. Am I missing something here? How do I trigger filter from here?

Thanks in advance.
~/Ananth
Eyup
Telerik team
 answered on 18 Jun 2015
1 answer
100 views

Hi,

 

In My Application I have Cascading combo box, User is selecting one combo box and based on selection of first combo box second combo box  will get populated,  now I am storing those values to database and I want to set the value of combo box from Java script to allow user to update those values. To do so how can I set the text of combo box having LoadOnDemand from javascript. e.g. My combobox will have the items as

Employee ID    EmployeeName

1                          ABC

2                          PQR

now I am getting PQR from database and I want to set it to Combo box having PopulateOnDemand Property = true. I tried to create the object of Combobox in JavaScript and then tried with FindItemByText property, but since combo box is configured to Load on demand it is not able to find anything and not able to set the value.

Please let me know how to do it using JavaScript.

Nencho
Telerik team
 answered on 18 Jun 2015
1 answer
216 views

How can I get all data from the RadGrid at client side to build a json string with the new data?

using the following code I Tried 

01.<telerik:GridTemplateColumn UniqueName="ColDepartment" DataField="DepartmentId" HeaderStyle-HorizontalAlign="Left">
02.<ItemTemplate>
03.      <asp:Label ID="DepartmentNameLbl" runat="server" Text='<%#Bind("Department.Name") %>'></asp:Label>
04.</ItemTemplate>
05. 
06.<EditItemTemplate>
07.      <telerik:RadDropDownList runat="server" ID="DepartmentsDdl" DataValueField="Id" DataTextField="Name" OnPreRender="DepartmentsDdl_PreRender"></telerik:RadDropDownList>
08.        </EditItemTemplate>
09.
</telerik:GridTemplateColumn>

1.batchManagerObject.getCellValue(cellObject);

but it gives me the displayed value [DepartmentName] What I need is the [DepartmentId]

Angel Petrov
Telerik team
 answered on 18 Jun 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?