Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
98 views

I have a grid in which two columns are linked, ie Project Type Categories and Project Types. On itemcreated I am adding select index changed and when editing it is working fine, however when inserting a new row, the second row does not reflect the changes.

.aspx

 

<

 

telerik:RadGrid ID="rgBenchmarkedHours" Skin="WebBlue" AutoGeneBenchmarkedHourColumns="false" Width="650px" AllowPaging="true" PageSize="10" OnPreRender="rgBenchmarkedHours_PreRender" OnNeedDataSource="rgBenchmarkedHours_NeedDataSource" OnUpdateCommand="rgBenchmarkedHours_UpdateCommand"

 

 

OnInsertCommand="rgBenchmarkedHours_InsertCommand"  OnDeleteCommand="rgBenchmarkedHours_DeleteCommand"

 

 

OnItemCreated="rgBenchmarkedHours_ItemCreated" runat="server">

 

 

 

<PagerStyle AlwaysVisible="true" Mode="Slider"/>

 

 

 

<HeaderStyle HorizontalAlign="Center" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

<AlternatingItemStyle HorizontalAlign="Left" />

 

 

 

<MasterTableView EditMode="InPlace" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordImageUrl="~/images/add.png"

 

 

CommandItemSettings-AddNewRecordText="Add row" AutoGenerateColumns="false" DataKeyNames="BenchmarkedHoursID" >

 

 

 

<Columns>

 

 

 

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" ItemStyle-HorizontalAlign="Center"></telerik:GridEditCommandColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="BenchmarkedHoursID" DataField="BenchmarkedHoursID" HeaderText="BenchmarkedHoursID" ReadOnly="true" Visible="false"></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="AgencyID" DataField="AgencyID" HeaderText="AgencyID" Visible="false"></telerik:GridBoundColumn>

 

 

 

<telerik:GridDropDownColumn UniqueName="ProjectTypeCategoryID" DataSourceID="ProjectTypeCategoryNameSource" ItemStyle-Width="250px"

 

 

 

DataField="ProjectTypeCategoryID" ListTextField="ProjectTypeCategoryName" ListValueField="ProjectTypeCategoryID" HeaderText="Project Type Category" ReadOnly="false"></telerik:GridDropDownColumn>

 

 

 

<telerik:GridDropDownColumn UniqueName="ProjectTypeNameDesc" DataSourceID="ProjectTypeNameSource" ItemStyle-Width="250px"

 

 

 

DataField="ProjectTypeID" ListTextField="ProjectTypeName" CurrentFilterFunction="EqualTo" CurrentFilterValue="ProjectTypeCategoryID" ListValueField="ProjectTypeID" HeaderText="Project Type">

 

 

 

</telerik:GridDropDownColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="Category" DataField="CategoryName" HeaderText="Category" ReadOnly="true"></telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="EASFunction" DataField="EASFunction" HeaderText="EASFunction" Visible="false"></telerik:GridBoundColumn>

 

 

 

<telerik:GridDropDownColumn UniqueName="EASFunctionDesc" DataSourceID="EASFunctionSource" ItemStyle-Width="250px"

 

 

 

DataField="EASFunction" ListTextField="EASFunctionDesc" ListValueField="EASFunction"

 

 

 

HeaderText="EAS Function"></telerik:GridDropDownColumn>

 

 

 

<telerik:GridNumericColumn UniqueName="BenchmarkedHour" DataField="Hours" HeaderText="Benchmarked Hour" NumericType="Number" ItemStyle-HorizontalAlign="Right"></telerik:GridNumericColumn>

 

 

 

<telerik:GridButtonColumn ConfirmText="Delete this Benchmarked Hour?" ConfirmDialogType="RadWindow"

 

 

 

ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"

 

 

 

UniqueName="DeleteColumn">

 

 

 

<ItemStyle HorizontalAlign="Center"/>

 

 

 

</telerik:GridButtonColumn>

 

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 

<

 

asp:SqlDataSource ID="ProjectTypeNameSource" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:EuroEstimatesConnectionString %>"

 

 

SelectCommand="SELECT PT.[ProjectTypeID], PT.[ProjectTypeName] FROM [ProjectTypes] PT UNION SELECT 0, '- Select Type' ORDER BY PT.[ProjectTypeName]">

 

 

</asp:SqlDataSource>

 

<

 

asp:SqlDataSource ID="ProjectTypeCategoryNameSource" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:EuroEstimatesConnectionString %>"

 

 

SelectCommand="SELECT [ProjectTypeCategoryID], [ProjectTypeCategoryName] FROM [ProjectTypeCategories] UNION SELECT 0, '- Select Category' ORDER BY [ProjectTypeCategoryName]">

 

 

</asp:SqlDataSource>


.cs

 

protected

 

void rgBenchmarkedHours_ItemCreated(object sender, GridItemEventArgs e)

 

{

 

if (e.Item is GridEditableItem && e.Item.IsInEditMode)

 

{

 

RadComboBox list = (e.Item as GridEditableItem)["ProjectTypeCategoryID"].Controls[0] as RadComboBox;

 

 

list.AutoPostBack =

true;

 

list.SelectedIndexChanged +=

new RadComboBoxSelectedIndexChangedEventHandler(list_SelectedIndexChanged);

 

}

}

 

void list_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)

 

{

 

GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem;

 

 

RadComboBox ddList = editedItem["ProjectTypeNameDesc"].Controls[0] as RadComboBox;

 

 

int ptc = int.Parse((editedItem["ProjectTypeCategoryID"].Controls[0] as RadComboBox).SelectedValue);

 

ddList.ClearSelection();

ddList.DataSource = da.GetProjectTypeNameDescription(ptc);

ddList.DataBind();

}



Thank you!

Princy
Top achievements
Rank 2
 answered on 24 Nov 2011
3 answers
147 views
On the bottom right hand side of the pager is the text that says, for example, "100 records in 4 pages". What I would like to do is changes this to say 75 records in 3 pages even if there are 100 records. The reason I want to do such an odd thing is that in some instances, there are 100 records, but 75 of them are parents, and 25 are children. I only want the parent records to be displayed in the "X records in Y pages" string. Is this possible?

I've tried the code in http://www.telerik.com/help/aspnet-ajax/grid-accessing-default-pager-buttons.html:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridPagerItem)
    {
        GridPagerItem item = e.Item as GridPagerItem;
        Label pageOfLabel = e.Item.FindControl("PageOfLabel") as Label;
        pageOfLabel.Text = "OF " + item.Paging.PageCount.ToString();
    }
}

When I run through the code, I get an exception - "Object reference not set to an instance of an object." - at the "pageOfLabel.Text..." line.

Thank you,
Scott
Jayesh Goyani
Top achievements
Rank 2
 answered on 24 Nov 2011
1 answer
109 views

I am using rad grid in my application .some of Data I have showed in rad grid .we have used 5 column in rad grid, like Name,  age, address, sex and date of birth .

We have given Search option for Filter column in rad gird. Filter Column are Rad combo box .in Age Filter combo box is not filtering (in rad grid Age Data type is integer)

function AgeIndexChanged(sender, args) {

        var Ageobj = $find("<%=rgResults.ClientID%>").get_masterTableView()

        Ageobj.filter("Age", args.get_item().get_value(), "Contains");

 

 

    }

 

 

Inside the Rad grid Column is like (Rad grid Id is rgResults)

 

 

  <telerik:GridBoundColumn DataField="Age" HeaderText="Age" SortExpression="Age" UniqueName="Age"

                            FilterControlWidth="50px" ItemStyle-Width="50px" AllowFiltering="true">

                            <FilterTemplate>

                                <telerik:RadComboBox ID="RadComboBoxAge" DataSourceID="AgeSqlDataSource" DataTextField="Age"

                                    DataValueField="Age" Width="50px" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Age").CurrentFilterValue %>'

                                    Height="200px" AppendDataBoundItems="true" runat="server" OnClientSelectedIndexChanged="AgeIndexChanged">

                                    <Items>

                                        <telerik:RadComboBoxItem Text="All" />

                                    </Items>

                                </telerik:RadComboBox>

                            </FilterTemplate>

                        </telerik:GridBoundColumn>

 

 

Can you please give the Correct Solution?

 

 

Shinu
Top achievements
Rank 2
 answered on 24 Nov 2011
1 answer
118 views
Hi,

Textchanged event on a RadTextBox  opens up a Radwindow,  how can I post back to the server without opening RadWindow.
This bug is seen only on Chrome, in firefox it works smoothly.

Thanks,
Prava
Princy
Top achievements
Rank 2
 answered on 24 Nov 2011
1 answer
79 views
Hi,

I have defined a RadLoadingPanel, in my master page ...
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel_LOS" runat="server" Skin="">
    <div style="height: 100%; width: 100%">
        <asp:Image ID="imgLoading" runat="server" ImageUrl="~/Images/Misc/loading2.gif" AlternateText="loading" />
    </div>
</telerik:RadAjaxLoadingPanel>

When it is displayed in a user control, which is a RadGrid, it is only appearing on top of the control... I've tried specifcying the Height to the hieght of the grid but it didnt work... is there something I am missing?
I 'd l ike it to appear in the center...

<telerik:AjaxSetting AjaxControlID="tsCRMPPSA">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="mpCRMPPSA" UpdatePanelHeight="400px" />
    </UpdatedControls>
</telerik:AjaxSetting>
Shinu
Top achievements
Rank 2
 answered on 24 Nov 2011
1 answer
294 views
Hi,

In our application we need to set radgrid column headerstyle-width by javascript.. For this we are using below code but nothing happened.

grid.get_masterTableView().getColumnByUniqueName("uniqueName").get_element().width = "1000px";
//grid.get_masterTableView().getColumnByUniqueName("UniqueName").get_element().clientWidth = "1000px";
grid.repaint();

Please help us.

Princy
Top achievements
Rank 2
 answered on 24 Nov 2011
4 answers
163 views
I have a grid that I'm just binding to a table in a database. Is there a way to put one more row on the end of that from the server? Essentially, I want to get the totals from that table and put in on the end of the grid as totals. so it would look something like this

Customer1 1 1 4 3
Customer2 1 2 3 5
Totals Here 2 3 7 8

Where Customer1 and Customer2 came from the table, and then totals here was added in the code behind. Is this possible?
Princy
Top achievements
Rank 2
 answered on 24 Nov 2011
1 answer
119 views
Hello,

i am getting the following error when trying to filter a GridDateTimeColumn:

Neither of the types 'String' and 'Nullable`1' converts to the other

this is the markup i have:

<telerik:RadGrid ID="ProcessesRadGrid" runat="server" Width="97%"  OnItemCommand="ProcessesRadGridItemCommand"
AllowPaging="true" PageSize="10" OnPageIndexChanged="ProcessesRadGrid_PageIndexChanged" OnNeedDataSource="ProcessesRadGrid_NeedDataSource" OnSortCommand="ProcessesRadGrid_SortCommand" AllowSorting="True">
        <MasterTableView AutoGenerateColumns="false" DataKeyNames="AcProcesses.Acprocessid" ClientDataKeyNames="AcProcesses.Acprocessid"
            Width="100%" CommandItemDisplay="Top" AllowFilteringByColumn="true">
                <CommandItemSettings ShowAddNewRecordButton="false" />
                <Columns>
                    <telerik:GridBoundColumn HeaderText="Organization" DataField="AcProcesses.Organization.Organizationname"></telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn  HeaderText="Start Date" DataField="AcProcesses.StartDate" SortExpression="AcProcesses.StartDate" DataType="System.DateTime" PickerType="DatePicker" DataFormatString="{0:dd/MM/yyyy}"  FilterControlWidth="100px">
                    </telerik:GridDateTimeColumn>
                    ........

Not sure what I'm missing... the weird thing is that i have another grid on the same page with filtering working on dates... i also noticed that on that second grid the filter button has less options (ex: it doesn't have 'contains')

Princy
Top achievements
Rank 2
 answered on 24 Nov 2011
1 answer
100 views
Hi,

I want  an ID of parent Table and the datakey value of recently expanded column on child grid's need data source event.  My code returns null value for currentGrid.NamingContainer .

  void childRadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                RadGrid currentGrid = sender as RadGrid;
                
        GridDataItem  parentItem =  (currentGrid.NamingContainer as  GridNestedViewItem ).ParentItem as GridDataItem;
..
..
..
}

Any idea?
Thanks
Prava
Shinu
Top achievements
Rank 2
 answered on 24 Nov 2011
4 answers
115 views
I need to center align the date number in monthview. Also need to change the default font of the number. How can this be done? I have a picky customer.

Thanks,
Dan
Dan
Top achievements
Rank 1
 answered on 23 Nov 2011
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?