Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
243 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
264 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
100 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
173 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
202 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
131 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
1 answer
117 views
This is strange. I have a radgrid with GridButtonColumn. The gridbuttoncolumn has a commandname of DeleteItem.

I pick this up on the server side in the Radgrid_Itemcommand sub. 

At this point I want to reference items in the grid to perform other functions. 

The code I have been using for an ID databound column (unique name mnu_3_id)

id =  radgrid1.Items.Item(e.Item.RowIndex)("mnu_3_id").Text

However, the rowindex that is returned is incorrect. It returns a number twice as big + 1. 

i.e. clicking row 0 results in a 2 being returned, row 1 a 4, row 2 a 6 etc.

I can obviously work around this, but why does it return the incorrect index?

Cheers

Tox
Shinu
Top achievements
Rank 2
 answered on 25 Jul 2011
2 answers
68 views
... now you don't.

I can't believe I am having this problem. I can make the rad window appear via a client side call to open it, but after postback the very same javascript will not open it.

I have created a small test project  to demonstrate the issue. I don't mind if this my own dumb fault, I just need to know why this is happening. :)

The form has a RadWindow inside a RadWindowManager and two buttons.

The first button is a regular html input type button that's 'onclick' calls the showWindow()  JS function.

The 2nd button is an asp:Button that on click postback to its own event handler. This method simply sets a value on the textbox that is in the window, then it registers some javascript that will call the ShowWindow function. It is on this 2nd call the ShowWindow fails to find the Window.

Here is the relevant part of the aspx code.

<head>
    <title>Now you see it...</title>
</head>
<body>
    <form id="form1" runat="server">
      
    <script type="text/javascript" language="javascript">
 
            function showWindow() {
                var win = $find("<%= RadWindow1.ClientID %>");
                alert(win); // Is NULL after post back
                win.show();
                win.center();
            }
 
    </script>  
 
    
   <asp:ScriptManager ID="ScriptManager1" runat="server">
   </asp:ScriptManager>
               
               <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                <Windows>
                    <telerik:RadWindow ID="RadWindow1" runat="server">
                        <ContentTemplate>
                            <asp:TextBox ID="tbTest" runat="server" />
                        </ContentTemplate>
                    </telerik:RadWindow>
                </Windows>
            </telerik:RadWindowManager>
    
    
           <input type="button" onclick="showWindow()" value="Client Side" />
                 
           <asp:Button ID="btnShowWindow"  runat="server" OnClick="btnShowWindow_Click" Text="Postback"/>
          
    </form>
</body>
</html>

The button event btnShowWindow_Click looks like this.

protected void btnShowWindow_Click(object sender, EventArgs e)
{
    tbTest.Text = "The window will not appear";
    string jScript = "showWindow();";
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "", jScript, true);
}

showWindow gets called just fine. However this time  does not work as the window is not found. (the Alert shows NULL)

This has to be simple. What am I missing here?


Brad
Top achievements
Rank 1
 answered on 25 Jul 2011
1 answer
1.5K+ views
How to remove the Alternative Row color in RadGrid?.

I have used the following two properties

ItemStyle-BackColor

 

="White" AlternatingItemStyle-BackColor="White"

 


When I use the above property the grid visibility having some patches. The attached image having the sample.

Princy
Top achievements
Rank 2
 answered on 25 Jul 2011
0 answers
75 views
Hi,
 I am new for this product. I have sharepoint 2007 and vs 2008. i would like to use RADGRID to display multiple sharepoint list with add and edit feature and also want to use master child feature. i would like to make custom web part only in C#. So can you please help me to create this web part.  I am looking for any example in C# so i can start.


Thank You So much in advance !!!
Dipesh
Top achievements
Rank 1
 asked on 25 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?