Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
100 views
I've been poking around various forums and help pages for a couple hours now and I'm still not sure if or how I can do this:

I'm using a RadGrid  populating from a List<Obj> reference within my code;  I hook this up with NeedsDataSource event.  As long as all my columns reference actual properties in the object, everything is easy. 

However, I also have a set of values that can vary from one query to the next; the object has a collections property containing those values.  My data is read-only, so I don't need to worry about editing in the grid, at this time.

My grid's Columns collection contains a sufficient number of "generic" columns that are all marked visible=false; in my Page_Load, I can set column headers and the visible property for the custom columns.    Ideally, I'd love to be able to put something like "CollectionProperty[0]" in the DataField property for the column, but I don't think this is supported.  (I was hopeful, but alas!)

So then, my next thought is handling some kind of event that fires for every cell, with a reference to the underlying DataItem object that fills out the rest of the columns - I just determine which custom column is asking for data and return the correct indexed value from the collection property.

I can't seem to find such a beast, though - is there such an event?  I've hooked up a number of event handlers hoping to spot something like this, and scanned the documents for a couple of hours, and I haven't found anything.  Surely there's a reasonable way to do this?
Steven Bixby
Top achievements
Rank 1
 answered on 29 Oct 2008
1 answer
200 views
I am having problems when I put a telerik control inside a <asp:panel visible="false"> on page load, then I set it to visible="true".  The telerik controls fail to work when they are invisible on page_load.  RadGrid for instance.  When I have the filter columns on, you type your criteria in and click the filter icon and nothing happens.  This also happens with RadTextbox.  The "EmptyMessage" does not disappear when you click inside the RadTextbox.

ex:

<asp:panel visible="false">
     <telerik:radeditor />
</asp:panel>

<asp:button> <!-- sets panel "visible=true" -->

The radeditor will display but the filters or any of the client events will not work.  I get a javascript error:

Error: $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_rgFamilies") is null
Source File: http://localhost:1337/blah.aspx
Line: 1

If the grid is visible on page_load, everything works as expected.
Shinu
Top achievements
Rank 2
 answered on 29 Oct 2008
3 answers
244 views
Hi Telerik.

Im having problems by retrieving the values entered into a Textbox in the Grid which is wrapped in a GridTemplateColumn.

What i want to do: I want to have one textbox for each row in the grid. then when the user clicks a button i want to loop through the whole grid and save the DataKeyValue and the value enterd in the text box in a StringDictionary for later use...

my acx file look like below
  <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="20" AllowSorting="True" Skin="Black" AllowPaging="True" 
            ShowGroupPanel="True" AutoGenerateColumns="False" GridLines="None">  
            <PagerStyle Mode="NumericPages"></PagerStyle> 
            <MasterTableView Width="100%" TableLayout="Fixed" EditMode="InPlace" DataKeyNames="ProfitCenterNo" Name="Master">  
                <GroupByExpressions> 
                    <telerik:GridGroupByExpression> 
                        <SelectFields> 
                            <telerik:GridGroupByField FieldAlias="CostPlace" HeaderText=" " FieldName="CostPlace"></telerik:GridGroupByField> 
                        </SelectFields> 
                        <GroupByFields> 
                            <telerik:GridGroupByField FieldName="CostPlace"></telerik:GridGroupByField> 
                        </GroupByFields> 
                    </telerik:GridGroupByExpression> 
                </GroupByExpressions> 
                <Columns>                           
                    <telerik:GridTemplateColumn UniqueName="NewTargetCol" HeaderText="Enter Target" Visible="false">  
                        <ItemTemplate> 
                            <asp:Panel ID="Panel1" runat="server">  
                                <asp:TextBox ID="NewTarget" runat="server" Text='<%# Bind("Target") %>'></asp:TextBox>                                  
                            </asp:Panel> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn>                                     
                      
                    <telerik:GridBoundColumn SortExpression="CostPlace" HeaderText="CostPlace" HeaderButtonType="TextButton" Visible="false" 
                        DataField="CostPlace">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn SortExpression="ProfitCenterNo" HeaderText="" HeaderButtonType="TextButton" Visible="false" 
                      DataField="ProfitCenterNo">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn ReadOnly="true" SortExpression="ProfitCenter" HeaderText="ProfitCenter" HeaderButtonType="TextButton"   
                        DataField="ProfitCenter">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn ReadOnly="false" SortExpression="TurnOver" HeaderText="TurnOver" HeaderButtonType="TextButton" 
                        DataField="TurnOver">  
                        <HeaderStyle/> 
                    </telerik:GridBoundColumn>                      
                    <telerik:GridBoundColumn SortExpression="Target" HeaderText="Target" HeaderButtonType="TextButton" UniqueName="Target"   
                        DataField="Target">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn ReadOnly="true" SortExpression="GrwLastHour" HeaderText="Growth last hour" HeaderButtonType="TextButton" 
                        DataField="GrwLastHour">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn ReadOnly="true" SortExpression="SpPrPax" HeaderText="Spending per pax" HeaderButtonType="TextButton" 
                        DataField="SpPrPax">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn ReadOnly="true" SortExpression="TgPrPax" HeaderText="Target per pax" HeaderButtonType="TextButton" 
                        DataField="TgPrPax">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn ReadOnly="true" SortExpression="RmPrPax" HeaderText="Remaining per pax" HeaderButtonType="TextButton" 
                        DataField="RmPrPax">  
                    </telerik:GridBoundColumn> 
                </Columns>                
 
                  
            </MasterTableView> 
 
</telerik:RadGrid> 
<asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" /> 


My Code behind where i loop throught the items in the grid and svaed the data to a string dictionary looks like this

       protected void Button2_Click(object sender, EventArgs e)  
        {  
 
            string profitCenterNo = "";  
            string profitCenterTarget= "";  
 
            StringDictionary sdProfitCenter = new StringDictionary();  
 
            foreach (GridDataItem item1 in RadGrid1.Items)  
            {  
                if (item1.OwnerTableView.Name == "Master")  
                {  
                    profitCenterNo = item1.GetDataKeyValue("ProfitCenterNo").ToString();  
                    profitCenterTarget = (item1["NewTargetCol"].FindControl("NewTarget"as TextBox).Text;  
                      
                }  
 
                sdProfitCenter.Add(profitCenterNo, profitCenterTarget);  
            }    
 
 
        } 

but im not able to retrieve the value from the textbox with this code. i only get a blank value.

I have the same problems if i try to use the build in edit functions in Radgrid. I cant switch to edit mode for the individual row enter my changes but im not able to catch the new values entered...

Im looking forward to you quick response.

Martin L
Shinu
Top achievements
Rank 2
 answered on 29 Oct 2008
3 answers
144 views
I have a scenario where I'm using the Radgrid with a datasource.  Depending on a certain condition in the grid's itemdatabound event, I'd like to insert/inject a new row into the row (item) collection.

For example, if I have a business condition, I want to add a placeholder row that says something like "Item skipped due to XXX".  I'm guessing that because the items are bound to the datasource, that it may be impossible to do this.  I am not using any sorting, grouping or filtering, so hopefully that helps since the grid is only getting bound once.

If I can't inject a row, can I some how show a grouping header for the rows and put my custom data in there?  It would almost be like re-purposing a group header when not using any grouping.

I hope this makes sense.  Thanks in advance for any suggestions!
Shinu
Top achievements
Rank 2
 answered on 29 Oct 2008
6 answers
153 views
Hi,

This is my Grid:

Last Row gets added with Height

See how it has a last row, I didn't add that and I want to know how it gets added?

Also notice how I've highlighted text in FireBug, the RadGrid is the Table and its in a DIV container with Height: 300px. When I use FireBug to remove the height the last row dissappears - just as I want.

So my question is whats the setting causing the containing DIV to be 300px?

<rad:RadGrid ID="RadGridGroup" runat="server" AutoGenerateColumns="False" GridLines="None" 
    ShowStatusBar="false" AllowPaging="false" ShowFooter="true" RadControlsDir="RadControls/"  
    OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound" Width="650px"
 
 <MasterTableView AutoGenerateColumns="False"
        <RowIndicatorColumn Visible="False"
            <HeaderStyle Width="20px"></HeaderStyle> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn Visible="False" Resizable="False"
            <HeaderStyle Width="20px"></HeaderStyle> 
        </ExpandCollapseColumn> 
        <Columns> 
        </Columns> 
    </MasterTableView> 
 
</rad:RadGrid> 
 




Meaning Of Lights
Top achievements
Rank 2
 answered on 29 Oct 2008
15 answers
133 views
if i want to use update panel from microsoft ajax and this gridview from telerik how do i include 2 script managers?
appdev
Top achievements
Rank 1
 answered on 29 Oct 2008
0 answers
82 views
        protected void ProvidersRadGrid_SelectedIndexChanged(object sender, EventArgs e)
{
// here
// I need put EditMode to RadGrid when i located in rowselected event
// Impotartant: i no need to change ProvidersRadGrid.MasterTableView.EditMode property
// i need put Edit State to Grid whatever user can see FormTemplate like as asp:FormView have ChangeMode(..) method
}

Thanks


Nimnul Prof
Top achievements
Rank 1
 asked on 28 Oct 2008
1 answer
163 views
Hi,

I'm trying to hide the expand/collpase images on rows that do not have nested data. I've tried to follow the advice in your help doc:

ms-help://telerik.aspnetajax.radcontrols.2008.Q2/telerik.aspnetajax.radgrid.2008.Q2/hide-expand-collapse-images-when-no-records-in-self-referencing-hierarchy.html

However, it doesn't work for me, perhaps because I'm using the <NestedViewTemplate> approach to build the nested data? Your example uses the PreRender event to hide the expand/collapse. Following your other example of how to do the manual <NestedViewTemplate> approach, I'm already building the nested HTML in the PreRender event already with code similar to this:

Protected Sub grid_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles grid.PreRender 
   Dim items As Telerik.Web.UI.GridItem() = grid.MasterTableView.GetItems(Telerik.Web.UI.GridItemType.NestedView) 
 
   For Each item As Telerik.Web.UI.GridNestedViewItem In items 
      'Customize the NestedViewTemplate.    
      Dim myData As MyDataObject = DirectCast(item.DataItem, MyDataObject) 
      Dim nestedTable As Table = item.FindControl("nestedTable"
 
      ...Build the nested HTML 
 
   Next 
End Sub 

Since I'm already looping through the NestedView collection it seems like it should be easy to get to the expand/collapse cell, but after trying many different ways to access it in the object model I'm lost. So my question is how to get to the parent row's expand/collapse cell when I have a GridNestedViewItem object.

Also, I prefer to keep using HierarchyLoadMode="Client" to avoid post-backs if possible.

Thank you,
Terry


terrysmith
Top achievements
Rank 1
 answered on 28 Oct 2008
2 answers
141 views
I'm using RadGrid with an EditForm.  I need to be able to attach JavaScript event code for a drop down control in the edit form.  The problem is, I don't know which event to use to get access to the control on the server side since none of them seems to have my <asp:DropDownList/> in its controls collections (the edit form however shows it plainly and it is able to update the data item just fine).

TIA 


SultanOfSuede
Top achievements
Rank 1
 answered on 28 Oct 2008
4 answers
167 views
Right clicking a picture and selecting set image properties dialog. The dialog does not have scroll bars so cannot see the ok or cancel button without tabbing to the end of the dialog. Is there a way to change this behavior?


Mark Greve
Top achievements
Rank 2
 answered on 28 Oct 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?