Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
160 views
Hi,
I have a radgrid which on one of its ItemCommands, it adds a new row to the database, rebinds to the grid.
When I use normal postback it works fine, but the ajaxified version does not work. 
I've looked at the http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-not-refreshing-after-ajax-and-rebind.aspx which was not much of help for me.

Here is the aspx file:

<telerik:RadScriptManager runat="server" ID="radScriptManager1" />

<telerik:RadGrid    runat="server"
                                ID="radGrid1" 
                                AutoGenerateColumns="False"
                                EnableViewState="True"
                                OnItemCreated="radGrid1_OnItemCreated"
                                OnItemCommand="radGrid1_OnItemCommand"
                                OnNeedDataSource="lnkCopyGrade_OnNeedDataSource">
                <MasterTableView AllowFilteringByColumn="False" CommandItemDisplay="None" ClientDataKeyNames="grade_id">
                    <SortExpressions>
                        <telerik:GridSortExpression FieldName="grade_name" SortOrder="Ascending"/>
                    </SortExpressions>
                    <SortExpressions>
                        <telerik:GridSortExpression FieldName="sort_order" SortOrder="Ascending"/>
                    </SortExpressions>
                
                    <Columns>
                        <telerik:GridTemplateColumn HeaderText="" AllowFiltering="False">
                            <ItemTemplate>
                                <asp:ImageButton runat="server" ID="lnkCopyGrade" AlternateText="Copy Grade"
                                                CommandArgument='<%# DataBinder.Eval(Container.DataItem,"grade_id") %>' 
                                                CommandName="copyGrade" ImageUrl="../../../images/icons/CopyIconSmall24x24.png" ToolTip="Copy Grade"/>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn    HeaderText="Full Name" DataField="grade_name" 
                                                    AllowSorting="True" AllowFiltering="False"/>
                        <telerik:GridBoundColumn HeaderText="Sort<br>Order" DataField="sort_order" ItemStyle-HorizontalAlign="Center" AllowSorting="True" AllowFiltering="False"/>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        
	<telerik:RadAjaxManager ID="ajaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="radGrid1" EventName="OnItemCommand">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="radGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

And here is the relevant codebehind 


	protected void radGrid1_OnItemCommand(object sender, GridCommandEventArgs e)
	    {
	        int iGradeID = RVConversion.ToInt32(e.CommandArgument);
	        string sGradeName = radGrid1.Items[e.Item.ItemIndex].Cells[(int) COLS.NAME].Text;
 
            	string sURL;
            	switch (e.CommandName)
            		{
                		case "copyGrade":
                    			CopyGrade(iGradeID);
                    		break;
            		}
	    }
 	private void CopyGrade(int gradeID)
	    {
            	//rv_copy_grade
            	var arrParams = new RVParamArrayList();
            	arrParams.addInt32Param("@gradeID", gradeID);
 
            	var result = RVDB.execCommand("rv_copy_grade", arrParams);
           	 radGrid1.Rebind();
	    }
	 protected void lnkCopyGrade_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
	    {
            	object o = null;
            	IRVPageData_Base_GetData(ref o, new object[] { Entity.EntityID, null });
            	var ds = (GradeDataSet)o;
 
            	DataTable table = ds.Tables[0];
 
            	const string sAccessColumnName = "access";
            	table.Columns.Add(sAccessColumnName, Type.GetType("System.Int32"));
            	RVUserMisc.AddGradeSecurityToTable(table, sAccessColumnName, this);
            	var dv = new DataView(table);
            	radGrid1.DataSource = dv;
	    }
Worth saying that at the end of
lnkCopyGrade_OnNeedDataSource database is getting updated but from the console window of the browser I can see that following exception is thrown : Uncaught Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '<!DOCTYPE html PUBLI'. Telerik.Web.UI.WebResource.axd:6
Error.create Telerik.Web.UI.WebResource.axd:6
Sys.WebForms.PageRequestManager._createPageRequestManagerParserError Telerik.Web.UI.WebResource.axd:15
Sys.WebForms.PageRequestManager._parseDelta Telerik.Web.UI.WebResource.axd:15
Sys.WebForms.PageRequestManager._onFormSubmitCompleted Telerik.Web.UI.WebResource.axd:15
(anonymous function) Telerik.Web.UI.WebResource.axd:6
(anonymous function) Telerik.Web.UI.WebResource.axd:6
Sys.Net.WebRequest.completed Telerik.Web.UI.WebResource.axd:6
_onReadyStateChange Telerik.Web.UI.WebResource.axd:6


Thanks.
Angel Petrov
Telerik team
 answered on 15 Nov 2012
2 answers
364 views
Hi,

I'm trying to override the default background color for the selected row in a grid when using the Transparent built in skin.
The simple reason is that the dfeulat selected row color is horrendous!
Anyway, to test whether i can get the selected row colour changed in my CSS file i used the following style:

.RadGrid_Transparent .rgSelectedRow td
{
    background-color: Red !important;
}

I used the red color for test purposes as this highlighted the issue a bit clearer than the light grey that i actually want to use. The color is changed in the selected row but there remains a second dark color in the selected row background which is overpowering & looks like a shading of black. I can't find a CSS or setting to remove this black shading.
Please see the attached picture.
I just want to change the default selected row colour to a light grey colour without a second colour or shade appearing.
Can anyone help with this?

regards,

Shuja
Shuja
Top achievements
Rank 1
 answered on 15 Nov 2012
1 answer
138 views
Hi,

I'm trying to create a column chart with multiple series. However, there are gaps between columns. Is there any way to remove the gap between columns? The chart in the non-html chart doesn't have the gaps.

Thanks!
Marin Bratanov
Telerik team
 answered on 15 Nov 2012
4 answers
221 views
Hello,

I am having an issue where the text displayed within the combobx is truncated when an explicit width is used and the browser is IE 8 with compatibility mode on.  Below is the RadComboBox definition and a screen print of the browser rendering.

Thanks,
Virgil


 

 

 

<telerik:RadComboBox ID="cboObjPriority" runat="server" Width="300px" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">
</telerik:RadComboBox>
  
    <script type="text/javascript">
  
  
        function OnClientSelectedIndexChanged(sender, args) {
  
            var combo = sender;
            var input = combo.get_inputDomElement();
  
            if (input.setSelectionRange) {
                input.setSelectionRange(0, 0);
            }
            else if (input.createTextRange) {
                var range = input.createTextRange();
                range.collapse(true);
                range.moveEnd('character', 0);
                range.moveStart('character', 0);
                range.select();
            }
  
        }
    </script>

Virgil Schleich
Top achievements
Rank 1
 answered on 15 Nov 2012
3 answers
248 views
Hi everyone

I have a chart with to line series (Image), with the OnClientSeriesHovered and a JS function I achieve the information of both series show and update on the table aside, but My boss want to put that table in the Tooltip:

With this code (C#), I achive this Image2:
series3.TooltipsAppearance.ClientTemplate = "Table on Tooltip
<table border=\"1\"><tr><td>Year S1</td><td>Value S1</td></tr>
<tr><td>Year S2</td><td>Value S2</td></tr></table>"
;

I try to change something like this:
<td id="R1">Year S1</td>

and whith Javascript try to change the value with:
document.getElementById('R1').innerHTML = "(value)";

But the "document.getElementById('R1')" return "NULL"

In the help Page ClientTemplate for Series Labels and Tooltips, explain how to define a Tooltip format, with a DataSource/DataBind option, so I think I may try to use this making two DataTable:
DT1:  (Value_Series1, Day, Value_Series1, Value_Series_2)
DT2:  (Value_Series2, Day, Value_Series1, Value_Series_2)

and in the code put somthing like this:
Day: #=dataItem.Day#
<table border=\"1\">
<tr><td>Year 1</td><td>#=dataItem.Value_Series1#</td></tr>
<tr><td>Year 2</td><td>#=dataItem.Value_Series2#</td></tr>
</table>


But I don't find the way to binding two DataTables, and if this will work.

Any advice?, please!
Filupa
Top achievements
Rank 1
 answered on 15 Nov 2012
4 answers
172 views
Hello,

This line work for a single DataKeyNames

RadToolTipManager1.TargetControls.Add(gridItem(column.UniqueName).ClientID, (TryCast(e.Item, GridDataItem)).GetDataKeyValue("MasterNum").ToString(), True)

Is there away to code this for multiple DataKeyNames eg.

 

DataKeyNames("MasterNum,LodgeNum")

 

 

 

 

 

SoniTek
Top achievements
Rank 1
 answered on 15 Nov 2012
3 answers
268 views
Hi,

I want to assign individual colors to my barserie items depending on some conditions. Like this example for the RadChart control:
http://www.telerik.com/help/aspnet-ajax/chart-how-to-assign-individual-colors-to-bars.html 

Is this possible?

Best regards,
Karl
Marin Bratanov
Telerik team
 answered on 15 Nov 2012
1 answer
127 views


I've got the line chart below on my page and am binding this to a dataset on click of a search button once the user has selected their criteria.

This dataset contains columns Country, Product & Price.  I would like Country displayed along the bottom (x-axis), and then have Price plotted on the graph for each product.

I believe I've got this defined correctly however when I run the report I get a js error "'t.options' is null or not an object".  Please can you advise on this?

In the code behind I'm simply retrieving my dataset and then:

chartPriceCorridor1.DataSource = Prices;

chartPriceCorridor1.DataBind();




<telerik:RadHtmlChart ID="chartPriceCorridor1" runat="server" Width="600px" Height="400px" Skin="Metro">
        <ChartTitle Text="Price Corridor" >
            <Appearance Align="Left" />
        </ChartTitle>
        <Legend>
            <Appearance Position="Bottom" />
        </Legend>
        <PlotArea>
            <Series>
                <telerik:LineSeries AxisName="Country" Name="Product" DataFieldY="Price"></telerik:LineSeries>
            </Series>
        </PlotArea>
    </telerik:RadHtmlChart>
Marin Bratanov
Telerik team
 answered on 15 Nov 2012
3 answers
127 views
It says in the documentation that you can only have 1 RadAjaxManager on a page... I am thinking that I could really use the RadAjaxManager to be multi-purpose! I am currently triggering the ajaxrequest from closing a spawned radwindow) see code below...
//OnClientClose function
function runthisOnWindowClose() {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
}

I was thinking that if I wanted to refresh my parent page from a second spawned radwindow ( on it's onclose event)....I would need to call a different code-behind function from the same RadAjaxManager's onajaxrequest property. So wouldn't it be nice if I could dynamically set the onajaxrequest from the codebehind when using a different popup.

Dana


Maria Ilieva
Telerik team
 answered on 15 Nov 2012
4 answers
191 views
In the attached image there is a RadGrid with a GridClientSelectColumn with some of the checkboxes disabled.

I would like the 'select all' checkbox at the top, to only select the rows that are enabled, just two rows in this case. I would like the 'select all' checkbox to function as it would normally, but only take into account the two rows that are enabled.

 e.g.

    . tick the 'select all' checkbox and both enabled rows are selected.

    . untick the 'select all' checkbox and both enabled rows are deselected.

    . tick the first enabled checkbox and then tick the second enabled checkbox and the 'select all' checkbox at the top becomes ticked and vice versa.

I've tried several different methods but each one has not quite worked, including various server side code and jQuery.

The problem with the most obvious approach is that the 'select all' checkbox at the top will end up ticking all the checkboxes regardless of whether they are enabled or not.

Many thanks in advance

Mike

Angel Petrov
Telerik team
 answered on 15 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?