Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
99 views
Hi, I need to have a data grid that enables something like a detailed row view.

A bit more details:
  • Need a data grid that has one column with a checkbox in it and a couple of more columns
  • when the checkbox is clicked I need the checked row to be displayed in a detailed row view
  • the detailed row view has fewer columns and different content in the columns
  • also I need the rows to have drag and drop enabled in both detailed row view and the initial row view

And an example for my case:
  • A table that has 6 columns that represent movie info: checkbox column, id, name, year, genre, budget.
  • What I need is when the checkbox in the first column is checked the row to display: checkbox column, name, short description, budget
  • So I need year and genre columns to be replaced by short description column.
  • when the checkbos is unchecked the row should be reverted to the previous state

Is this possible to be done with the telerik RadGrid? And can you please provide short code or directions how to be achieved?
Sebastian
Telerik team
 answered on 25 Jul 2011
1 answer
280 views
Hi,

I would like to include multiple attachment columns in a RadGrid that is built dynamically.
All the attachments are comming from the same SQL table (ID, FileName, document).
Therefore my RadGrid data contains several columns generated by a stored procedure:
  • ID1, FileName1
  • ID2, Filename2
  • ID3, Filename3
  • ...

I am using SQL Server stored procedures, and specifically a proc called "getDocument" that has a single parameter: "@ID" declared as an "int" and returning "document" (the file data; varbinary). This procedure is delcared in an SqlDataSource (SqlDataSourceAttachment), with a single parameter "ID".

The problem is that in order to manage the attachment columns with several GridAttachmentColumn using that SqlDataSourceAttachment, I would have to map the @ID parameter of the SqlDataSourceAttachment with the RadGrid data columns i.e. ID1, ID2, ID3... and not just ID.

Any suggestions on how I can do that ?

François
Francois MARTIN
Top achievements
Rank 2
 answered on 25 Jul 2011
1 answer
93 views
If I move the pager, in NeedDataSource the CurrentPageIndex  is set to the current one, not to the desidered one.

To make correctly I need to manually set the CurrentPageIndex = e.NewPageIndex in the PageIndexChanged event and force a Rebind().

Is there an other way? Why I need to ask data twice to have data paged as I need (unfortunately the PageindexChanged is fired after NeedDataSource)?

Thanks

Princy
Top achievements
Rank 2
 answered on 25 Jul 2011
1 answer
109 views
I have a master/detail radgrid tied to EntityDataSOurce controls.

I can't get the where clause to work so want to use OnQueryCreated for the details table to do the proper subsetting.

I have this working with a kludge by having ItemCommand "ExpandCollapse" save the Id of the parent record that I drill into in a sesison variable and then read that session variable in the OnQueryCreated event handler for the detail table. And that works but feels bad.

How can I get the parent item Id directly from OnQueryCreated?

If I try to access like this -

    rgrdStatus.MasterTableView.DetailTables[0].ParentItem.GetDataKeyValue(

 

"Id")

the ParentItem is always null!

Thanks!

 

Shinu
Top achievements
Rank 2
 answered on 25 Jul 2011
3 answers
233 views

I am trying to bind to my labels in my nestedview template in my radgrid, but looking at telerik site but have not been able to find how they bind throught he code behind page and get a hold of the data key in the parenttablerelation.  How can I bind to my controls via code behind page.  I thought through the detialtabledatabind but nothing works for nested views.


 Protected Sub myGridDeploy_DetailTableDataBind(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles myGridDeploy.DetailTableDataBind

        If e.DetailTableView.Name = "myUnitPos" Then
            sql = "Select intPositionId, intUnitMobId, strPosnTitle, strPara, strLine, intPositionNum, strGrade, strMOS, strASI, strAuthBr, Case when intAsgnstr = 0 " _
                & "then 'NO' else 'YES' end Filled From tblMobUnitPosition where intUnitMobID = " & e.DetailTableView.ParentItem.GetDataKeyValue("intUnitMobId") & " " _
                & "order by strPara, strLine, intPositionNum"

            e.DetailTableView.DataSource = getData(sql)
        End If

        sql = "Select intDeployId,intPositionId,si.FullName,si.strRank,si.AGE,si.strPmos,si.strSMOS,si.POSN_NBR_EXCESS_IND,si.SCTY_CLNC,si.ETS,si.strstatus,si.PHYS_PRFL_SER,si.intYearSvc, si.SRpDate,si.Deployable, " _
            & "si.email From tblMobUnitPersonnel as up LEFT JOIN vw_Soldierinfo as si on si.strssn = up.strSSN where up.intPositionId = " & e.DetailTableView.ParentItem.GetDataKeyValue("intPositionId") & ""

    End Sub


<telerik:GridTableView DataKeyNames="intPositionId" Name="myUnitPos" Width="100%" TableLayout="Fixed" BorderWidth="1px" CellPadding="6" Font-Size="10"
                                    AutoGenerateColumns="False" HeaderStyle-HorizontalAlign="Center" BorderColor="#404040" Font-Names="Veranda,arial,sans-serif" GridLines="Both" ExpandCollapseColumn-ButtonType="ImageButton"
                                    ExpandCollapseColumn-CollapseImageUrl="~/Images/30.png" ExpandCollapseColumn-ExpandImageUrl="~/Images/29.png">
                                    <ParentTableRelation>
                                        <telerik:GridRelationFields DetailKeyField="intUnitMobId" MasterKeyField="intUnitMobId" />
                                    </ParentTableRelation>
                                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" CssClass="InnerSubHeaderStyle" />
                                    <ItemStyle CssClass="InnerSubItemStyle" HorizontalAlign="Center"  />
                                    <AlternatingItemStyle CssClass="InnerSubAlernatingItemStyle" HorizontalAlign="Center" />
                                        <NestedViewSettings>
                                            <ParentTableRelation>
                                                 <telerik:GridRelationFields DetailKeyField="intPositionId" MasterKeyField="intPositionId" />
                                            </ParentTableRelation>
                                        </NestedViewSettings>
                                        <NestedViewTemplate>
                                            <asp:Panel ID="pnlInfo" runat="server" BorderStyle="Double" BorderColor="#85A3E0" Width="50%">
                                                <table >
                                                    <tr>
                                                        <td><u>Soldier Information</u></td>
                                                    </tr>
                                                    <tr>
                                                        <td style="height:5px"></td>
                                                    </tr>
                                                     <tr>
                                                        <td>
                                                            Name:&nbsp;<asp:Label ID="lblSoldier" runat="server" Text='<%#Bind("FUllName") %>'></asp:Label>&nbsp;&nbsp;
                                                            Rank:&nbsp;<asp:label ID="lblRank" runat="server" Text='<%#Bind("strRank") %>'></asp:label>&nbsp;&nbsp;
                                                            Age:&nbsp;<asp:Label ID="lblAge" runat="server" Text='<%#Bind("AGE") %>'></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="height:5px"></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            PMOS:&nbsp;<asp:Label ID="lblPMOS" runat="server"></asp:Label>&nbsp;&nbsp;
                                                            SMOS:&nbsp;<asp:label ID="lblSMOS" runat="server"></asp:label>&nbsp;&nbsp;
                                                            POSN Excess:&nbsp;<asp:Label ID="lblPOSN" runat="server"></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="height:5px"></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            Clearance:&nbsp;<asp:Label ID="lblClear" runat="server"></asp:Label>&nbsp;&nbsp;
                                                            ETS\MRD:&nbsp;<asp:label ID="lblEts" runat="server"></asp:label>&nbsp;&nbsp;
                                                            Full-Time:&nbsp;<asp:Label ID="lblFullTime" runat="server"></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="height:5px"></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            PULHES:&nbsp;<asp:Label ID="lblPuhles" runat="server"></asp:Label>&nbsp;&nbsp;
                                                            Yrs Active:&nbsp;<asp:label ID="lblYrsActive" runat="server"></asp:label>
                                                        </td>
                                                    </tr>
                                                     <tr>
                                                        <td style="height:5px"></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            SRP Date:&nbsp;<asp:Label ID="lblDtSrp" runat="server"></asp:Label>&nbsp;&nbsp;
                                                            Deployable:&nbsp;<asp:label ID="lblDeplyable" runat="server"></asp:label>
                                                        </td>
                                                    </tr>
                                                     <tr>
                                                        <td style="height:5px"></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            Email:&nbsp;<asp:Label ID="lblEmail" runat="server"></asp:Label>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </asp:Panel>
                                        </NestedViewTemplate>
                                        <Columns>




Genti
Telerik team
 answered on 25 Jul 2011
3 answers
248 views
Hi,

I have a table named Orders with a field "ChildFirstName". I like to get the total count of each ChildFirstNameand its percentage against total number of table. I create the query for that is

SelectCommand="SELECT [ChildFirstName], [COUNT(ChildFirstName) AS QuantityOrdered], [(QuantityOrdered * 100 / (SELECT COUNT(*) FROM Orders)) AS Percentage] FROM [Orders] GROUP BY [ChildFirstName] ORDER BY [ChildFirstName] DESC"

I create radgrid to display it,
                    <Columns>
                            <telerik:GridBoundColumn DataField="ChildFirstName" HeaderText="Child's First Name"
                            SortExpression="ChildFirstName" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" UniqueName="ChildFirstName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="QuantityOrdered" HeaderText="Quantity Ordered"
                            SortExpression="QuantityOrdered" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" UniqueName="QuantityOrdered">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Percentage" HeaderText="Percentage"
                            SortExpression="Percentage" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" UniqueName="Percentage">
                        </telerik:GridBoundColumn>
                    </Columns>
 
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:freepersonalizedConnectionString %>"
            SelectCommand="SELECT [ChildFirstName], [COUNT(ChildFirstName) AS QuantityOrdered], [(QuantityOrdered * 100 / (SELECT COUNT(*) FROM Orders)) AS Percentage] FROM [Orders] GROUP BY [ChildFirstName] ORDER BY [ChildFirstName] DESC">
        </asp:SqlDataSource>
But it gives error:
Invalid column name 'COUNT(ChildFirstName) AS QuantityOrdered'.
Invalid column name '(QuantityOrdered * 100 / (SELECT COUNT(*) FROM Orders)) AS Percentage'.


How to do it in right? Thanks.
Marin
Telerik team
 answered on 25 Jul 2011
1 answer
89 views
When i keep zooming a RadDock for more than 100%, dotted lines appear under panels. The scenario exist only in IE, firefox doesnot render these kinds of defects. What can be done for avoiding such unwanted lines?
Bozhidar
Telerik team
 answered on 25 Jul 2011
1 answer
147 views
Proble:
In NeedDataSourece event I need to find the source event which has trigerred the NeedDataSource.

Senario :
Steps:
1. In my Radgrid I have set the EnableViewState="false",  then I set the AllowRowSelect="true" in <clientsettings>

2. In code behing I have written a custom function to identify a the selected rows

3. After selecting a page number in my Radgrid pager, it is triggering the NeedDatasource event.

4. I need to Identify whether the NeedDatasource is trigerred from the PageItemChanged Event

5. Before moving to the another page, I have to get the selected rows from the current page.



 

Shinu
Top achievements
Rank 2
 answered on 25 Jul 2011
5 answers
186 views
Hello

I'm currently running the Rad editor v 4.4.1.0 in a sharepoint environment and I've noticed that if I insert the tags select(dropdown) or <script>(for javascript) that the editor would remove certain attributes or the whole tags.

Is there any way to work around this issue?
Stanimir
Telerik team
 answered on 25 Jul 2011
1 answer
116 views
hi

I have a table with only one TemplateColumn.
but this column must show different figures by TYPE column of dataset. for example, if TYPE=1 then show user picture, Name and Family
and if TYPE=2 then show some other columns with a special figure.
that means i want make a table with Facebook wall stye that in every rows shows some data with true Template.
witch solution do you refer?

best regards
Mohammad

Princy
Top achievements
Rank 2
 answered on 25 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?