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

Hi there,

I got a wierd problem on RadGrid when using inside a dynamically loaded (using LoadControl)  Usercontrol. the sorting not seems to work properly. I intially got this error

 $WebAnalytics$ReportViewer1$GeneralSummary1$rgGeneralSummary$ctl01$ctl02$ctl01$ctl03' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.

 
I am using the NeedDataSource to assign the datasource (without calling databind). Here is the declaration of the RadGrid.

<rad:RadGrid ID="rgGeneralSummary" runat="server" GridLines="None" AllowPaging="True"ShowStatusBar="true" PageSize="20" RadControlsDir="~/Resources/RadControls/" Skin="WebBlue" SkinID="WebBlue" SkinsPath="~/Resources/RadControls/Grid/Skins" AllowSorting="True" CellSpacing="10" CellPadding="5" AllowFilteringByColumn="false" ShowGroupPanel="True" Width="650px" AutoGenerateColumns="False" EnableAJAX="true" EnableAJAXLoadingTemplate="true" Height="250px" OnNeedDataSource="rgGeneralSummary_NeedDataSource">

<ClientSettings AllowDragToGroup="False">
<Scrolling AllowScroll="True" UseStaticHeaders="True" /></ClientSettings>

 <PagerStyle PagerTextFormat="&lt;strong&gt;{5} Records&lt;/strong&gt;. Change page: {4} &amp;nbsp;|&amp;nbsp; Displaying page {0} of {1}, items {2} to {3} of {5}." />

<MasterTableView AutoGenerateColumns="False" AllowFilteringByColumn="false" DataSourcePersistenceMode="ViewState"> 
<Columns>
<rad:GridBoundColumn DataField="Period" DataType="System.String" HeaderText="Period" SortExpression="Period" UniqueName="Period" ItemStyle-Width="130px" HeaderStyle-Width="130px">

 </rad:GridBoundColumn>
<rad:GridBoundColumn DataField="PageViews" DataType="System.Int32" HeaderText="PageViews"ItemStyle-Width="130px" HeaderStyle-Width="130px" ReadOnly="True" SortExpression="PageViews" UniqueName="PageViews">

 </rad:GridBoundColumn>

 <rad:GridBoundColumn DataField="Sessions" DataType="System.Int32" HeaderText="Sessions"ItemStyle-Width="130px" ReadOnly="True" HeaderStyle-Width="130px" SortExpression="Sessions" UniqueName="Sessions">

 </rad:GridBoundColumn>

 <rad:GridBoundColumn DataField="UniqueVisitors" DataType="System.Int32" HeaderText="Unique Visitors"

 ItemStyle-Width="130px" HeaderStyle-Width="130px" ReadOnly="True" SortExpression="UniqueVisitors" UniqueName="UniqueVisitors">

 </rad:GridBoundColumn>

 <rad:GridBoundColumn DataField="ViewsPerSession" DataType="System.Decimal" HeaderText="Page views per session" ItemStyle-Width="130px" HeaderStyle-Width="130px" ReadOnly="True" SortExpression="ViewsPerSession" UniqueName="ViewsPerSession">

 </rad:GridBoundColumn>

 </Columns>

 </MasterTableView>

 </rad:RadGrid>

Later i checked this post and introduced ItemCreated to set the Header links Id. This avoids the exception but issue still there. The sorting works fine in ascending order but the decending order is not working.

Please help me to fix this sorting issue.

Sekar
Top achievements
Rank 1
 answered on 26 Aug 2008
0 answers
70 views
Hi

In some cases I am getting Exception 500, so basically I attach debugger and trace line by line to find the cause. Is there anyway to get full exception logged in the eventlog or actual c# exception is thrown? That will make debugging very easy.

Thanks
Imtiaz

Imtiaz
Top achievements
Rank 1
 asked on 26 Aug 2008
5 answers
253 views

My Problem: The update command (and insert command) is not refreshing the grid.  I have a problem with both insert and update, but for this post lets just focus on update.

My Code:
I have a data grid (residing on a tab).  

I am using InLine Edit Mode, with no column templates.

When the user edits the row and later clicks the Update command, I execute my OnUpdateCommand() method.  In this method, I successfully pull the user inputs, execute the SQL updates. All is good.

The inline edit, goes away, but the user does not see the data grid reflect the update.

Now the user can hit the refresh data grid command, and that will work.

I then attempted to execute the same refresh command after the OnUpdateCommand had done it's work, but still no grid refresh.

Why I am Picking-On the OnUpdateCommand:

OnUpdateCommand="grdAltProductCodes_UpdateCommand" 

I went to the grid's mark up, removed the OnUpdateCommand attribute.  The result is that the user 

  • clicks edit
  • changes text box data
  • [I sneak over to the sql table and add/update 5 new records] 
  • clicks update command, [no sql update occurs cause we are not calling the OnUpdateCommand ]. 
  • the data grid refreshes and the user sees the 5 updates I did directly to the database.

So everything is fine, till I attempt to use the OnUpdateCommand.  Then no grid refresh.

So what does my OnUpdateCommand have to do, to force the data grid to refresh? 
Is there a good, simple demo available?  Everything I found was for the automatic updates.

Also, I did grabbed the latest code as of yesterday.

Thank You!

protected void grdAltProductCodes_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
{  
    AlternateProductCodeDC altProductCode = new AlternateProductCodeDC();  
 
    //The GridTableView will fill the values from all editable columns in the hash  
    GridEditableItem editedItem = e.Item as GridEditableItem;  
    Hashtable newValues = new Hashtable();  
    e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);  
 
    //Set Primary Key Stored as a Delimited Value within the Query String  
    string[] selectedRecord = Request.QueryString["i"].Split(',');  
    this._presenter.OnViewInitialized(Int32.Parse(selectedRecord[0]), selectedRecord[1], selectedRecord[2], selectedRecord[3], DateTime.Parse(selectedRecord[4]));  
    altProductCode.MasterCompanyId = Int32.Parse(selectedRecord[0]);  
    altProductCode.CountryCode = selectedRecord[1];  
    altProductCode.Jurisdiction = selectedRecord[2];  
    altProductCode.ProductCode = selectedRecord[3];  
 
    //Read user values              
    altProductCode.AlternateProductCode = Convert.ToString(newValues["Alternate_Product_Code"]);  
    altProductCode.EffectiveDate = Convert.ToDateTime(newValues["Effective_Date"]);  
    if (newValues["Obsolete_Date"] == null)  
    {  
        altProductCode.ObsoleteDate = null;  
    }  
    else 
    {  
        altProductCode.ObsoleteDate = Convert.ToDateTime(newValues["Obsolete_Date"]);  
    }  
 
    //Have the presenter update the database  
    _presenter.OnAlternateProductCodeUpdate(altProductCode);  
 
    //Somehow get the datagrid to refresh itself  
    //RefreshGrid();  
    //e.Canceled = false;  



 

Jeff
Top achievements
Rank 1
 answered on 26 Aug 2008
4 answers
138 views
Following the example on wizard type by using tabstrip, I encounter a problem that the tabstrip is inside a aspx page using master page to display some common info. (http://www.telerik.com/demos/aspnet/prometheus/TabStrip/Examples/ApplicationScenarios/Wizard/DefaultCS.aspx)


On referring tabstrip in one of user control, I recevie an error of "object reference" where it is null on debugging.

Can you advice how to work around this problem?
Raymond
Top achievements
Rank 1
 answered on 26 Aug 2008
1 answer
158 views
Hello,

 I am using grid with client selection column and multiple selction enabled. And During the itemDataBound event I need to disable selecting for rows with specific data. Can I do this somehow with using client selection functionality or do I need to implement selecting myself?

Thanks
Jan
jan
Top achievements
Rank 1
 answered on 26 Aug 2008
5 answers
124 views

I tried to create a combobox with treeview and I did basicaly exactly what you do in the ComboBox/Tree example.

http://www.telerik.com/DEMOS/ASPNET/Prometheus/TreeView/Examples/Functionality/TreeViewComboBox/DefaultCS.aspx

I am placing the combobox in a user control and the user control inside a content page which is inherits from a master page. I placed a script manager in the master page. My sample application is ASP.NET 2  AJAX-Enabled.

The problem is when I click on any tree node the combobox text is not getting the node text value and also the tree view is not disappearing after selection of the node.

Please how can I resolve this problem?

Ahmad Alkhiary
Top achievements
Rank 1
 answered on 26 Aug 2008
3 answers
174 views
Hi, I am trying to make a RadEditor readonly, Enabled = false doesn't work because any long text does not wrap and is not readable.  Version of RadControls is 2008.1.515.20.  Also, the Editor is nested in a RadPanel.  Thanks

Gary
George
Telerik team
 answered on 26 Aug 2008
2 answers
84 views
Hey everyone, I have a gridbuttoncolumn at the top level of a 3 level hierarchical grid and I am trying to modify the cells of this column in the ItemCreated event for the grid.  It works fine on initial load but then when a column is expanded it loses the changes.  If there is a better way of doing this please let me know but really I just wan't the link to display if a condition is true that I am checking in the ItemCreated event.  The code for the event is below.


protected void grdVariableLst_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            if (e.Item.OwnerTableView.Name == "Variables")  
            {  
                if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)  
                {  
                    GridDataItem item;  
                    item = (GridDataItem)e.Item;  
                    if (int.Parse(((System.Data.DataRowView)(e.Item.DataItem)).Row.ItemArray[4].ToString()) == 1)  
                    {  
                        item["DeleteColumn"].Text = "Delete";  
                    }  
                }  
            }  
        } 
Nate
Top achievements
Rank 1
 answered on 26 Aug 2008
4 answers
190 views
I'm usnig your RadCOmboBox on several of my pages.  It is the same in all pages "Users"  How can I make it so that the code behind is reused for the one dropdownlist?  Also, how do I access the dropdown items in the events of the code behind like Button_OnClick ?
Mike
Top achievements
Rank 1
 answered on 26 Aug 2008
1 answer
199 views
When you have a grid that has an ID that starts with an underscore (_), the selection does not work. 

The problem is that the javascript code in GridSelection.js does not handle the case where a grid is contained by a runat="server" control AND it's ID begins with an underscore.  In this case, the generated ID has two underscores next to each other in the generated client id.  And throughout GridSelection.js, there are lines such as:

if( el.id.split("__").length == 2 )


When your grid is contained by another runat=server control, the generated client id could be something like this:
ct100_container__grid__0, in which case the length of el.id.split("__") is 3, not two, so the client side selection code breaks.  It is important to note that a leading underscore is a perfectly valid control ID, which has the side effect of breaking the client side selection.

According to this thread, the problem will be fixed in the next update.  According to the bug report with ID 157577, the problem is too hard to fix, and Telerik may consider adding a note to the documentation to help you avoid the problem.

So, whether the forum or the bug report is correct, you might want to avoid using variables that start with a leading underscore, as it took me two days to find the problem and create a sample application.

Thanks,

Matt
Veli
Telerik team
 answered on 26 Aug 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?