Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
185 views
Hi,
Is there a way to add radio button to all cells of grid. Only one cell of the grid will be selected(checked) at same time. I couldn't find changing button type to radio. For normal radbutton, it  is "ButtonType="ToggleButton" ToggleType="Radio".

Think that there is a gird which has 3 columns and 3 rows.  First column's type is datetime. Other two columns' type is boolean and shown at cell as radio button.  User will be able to select only one radio of the matrix.

Regards,

view;
                   cola      colb   
date1              O        O
date2              O        O
date3              O        O


GridButtonColumn btnCol = new GridButtonColumn();
                btnCol.DataTextField = c.ToString();
                btnCol.HeaderText = dt.Columns[c].Caption;
                btnCol.HeaderStyle.Font.Bold = true;
                btnCol.ButtonType = GridButtonColumnType.LinkButton;
                rgridDeliveryDate.MasterTableView.Columns.Add(btnCol);
Princy
Top achievements
Rank 2
 answered on 10 Jan 2011
1 answer
215 views
Hi 
On my RadGrid i have some bound columns and some template columns.
I want to simply save all my RadGrid data into my sql datatable on a button click. 
Can anybody send some sample code for that using RadGrid.

Code for my radgrid is-

<telerik:RadGrid ID="GD_Prod" runat="server" AllowPaging="True" ShowHeader="False"
                    AutoGenerateColumns="False"  GridLines="None"
                    Height="173px" Skin="Outlook" Width="1107px">
                    <ClientSettings AllowColumnsReorder="True">
                        <Selecting AllowRowSelect="True" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                    <MasterTableView PageSize="5" >
                        <RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
    <Columns>
        <telerik:GridBoundColumn DataField="port_recipe_num" HeaderText="Recipe #" SortExpression="port_recipe_num"
            UniqueName="port_recipe_num" DataType="System.Char">
            <HeaderStyle Width="17px" />
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="DESC_ALT" HeaderText="Description" SortExpression="DESC_ALT"
            UniqueName="DESC_ALT" DataType="System.Char">
            <HeaderStyle Width="36px" />
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="port_no_servings" HeaderText="Portion Size" SortExpression="port_no_servings"
            UniqueName="port_no_servings" DataType="System.Char">
            <HeaderStyle Width="16px" />
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn UniqueName="PL_STUDENT_Portions_Planned" DataType="System.Int32">
            <ItemTemplate>
                <asp:TextBox ID="TxtSTUPort" DataField="PL_STUDENT_Portions_Planned" runat="server"
                    Height="16px" Width="30px"></asp:TextBox>
            </ItemTemplate>
            <HeaderStyle Width="19px" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn UniqueName="PL_Adults_ALC_Portions_Planned" DataType="System.Int32">
            <ItemTemplate>
                <asp:TextBox ID="TxtAAPort" DataField="PL_Adults_ALC_Portions_Planned" runat="server"
                    Height="16px" Width="30px"></asp:TextBox>
            </ItemTemplate>
            <HeaderStyle Width="19px" />
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn DataField="STD_NUM_OF_SERVING" DataType="System.Int32" HeaderText="STD_NUM_OF_SERVING"
            SortExpression="STD_NUM_OF_SERVING" UniqueName="STD_NUM_OF_SERVING">
            <HeaderStyle Width="14px" />
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn UniqueName="PL_Factor_Portions" DataType="System.Char">
            <ItemTemplate>
                <asp:TextBox ID="TxtFPort" DataField="PL_Factor_Portions" runat="server" Height="16px"
                    Width="30px"></asp:TextBox>
            </ItemTemplate>
            <HeaderStyle Width="18px" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn UniqueName="DOC_Quantity_Of_Food_Used" DataType="System.Char">
            <ItemTemplate>
                <asp:TextBox ID="TxtQoFUsed" DataField="DOC_Quantity_Of_Food_Used" runat="server"
                    Height="16px" Width="30px"></asp:TextBox>
            </ItemTemplate>
            <HeaderStyle Width="20px" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn UniqueName="DOC_Portions_Prepared" DataType="System.Int32">
            <ItemTemplate>
                <asp:TextBox ID="TxtPPort" DataField="DOC_Portions_Prepared" runat="server" Height="16px"
                    Width="30px"></asp:TextBox>
            </ItemTemplate>
            <HeaderStyle Width="16px" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn UniqueName="DOC_Portions_Brought_Forward" DataType="System.Int32">
            <ItemTemplate>
                <asp:TextBox ID="TxtBFPort" DataField="DOC_Portions_Brought_Forward" runat="server"
                    Height="16px" Width="30px"></asp:TextBox>
            </ItemTemplate>
            <HeaderStyle Width="16px" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn UniqueName="DOC_Portions_LeftOver" DataType="System.Int32">
            <ItemTemplate>
                <asp:TextBox ID="TxtLOPort" DataField="DOC_Portions_LeftOver" runat="server" Height="16px"
                    Width="30px"></asp:TextBox>
            </ItemTemplate>
            <HeaderStyle Width="16px" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn UniqueName="DOC_LeftOver_Code" DataType="System.Char">
            <ItemTemplate>
                <asp:DropDownList ID="ddlLOCode" DataField="DOC_LeftOver_Code" runat="server" Font-Size="10px"
                    Height="16px" Width="46px">
                    <asp:ListItem>CF</asp:ListItem>
                    <asp:ListItem>DIS</asp:ListItem>
                    <asp:ListItem>ALC</asp:ListItem>
                    <asp:ListItem>RTB</asp:ListItem>
                    <asp:ListItem>RTF</asp:ListItem>
                </asp:DropDownList>
            </ItemTemplate>
            <HeaderStyle Width="16px" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn UniqueName="DOC_Total_Portions_Served" DataType="System.Int32">
            <ItemTemplate>
                <asp:TextBox ID="TxtTSPort" DataField="DOC_Total_Portions_Served" runat="server"
                    Height="16px" Width="30px"></asp:TextBox>
            </ItemTemplate>
            <HeaderStyle Width="16px" />
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn UniqueName="POSStudents"
            DataType="System.Int32" DataField="POSStudents" HeaderText="POSStudents" 
            SortExpression="POSStudents">
            <HeaderStyle Width="18px" />
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn UniqueName="POSAdultsALC"
            DataType="System.Int32" DataField="POSAdultsALC" HeaderText="POSAdultsALC" 
            SortExpression="POSAdultsALC">
            <HeaderStyle Width="16px" />
        </telerik:GridBoundColumn>
    </Columns>
    <PagerStyle AlwaysVisible="True" />
</MasterTableView>
                </telerik:RadGrid>
Shinu
Top achievements
Rank 2
 answered on 10 Jan 2011
2 answers
125 views
I am new to Telerik - and fairly new to ASP.NET - so please bare with me...

I have one master grid - and one detail grid.  In the detail grid I have a hyperlink (Link Button).

This hyperlink is meant to open an Image (PDF) in my SQL database.  

I figured I would do this by sending the value of the clicked item (a GUID) to the code behind - so I can then search for the image and open it up. Whatever I do, I can't figure out how to pass the GUID that was selected to the code behind.

I was able to get the value of every GUID in the column - but not the one I selected.  Could anyone steer me on the right path?  I have spent days trying to do this - I would think that this should be fairly easy...

HTML
<asp:LinkButton runat="server" CausesValidation="false" CommandName="Select"
    Text="View"></asp:LinkButton>

VB.NET
Protected Sub RadGrid2_SelectedIndexChanged(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid2.SelectedIndexChanged
 
    Dim gridDataItem As GridDataItem = TryCast(e.Item, GridDataItem)
    If e.Item.OwnerTableView.GetColumnSafe("GUID") IsNot Nothing Then
 
        Dim cell As TableCell = TryCast(gridDataItem("GUID"), TableCell)
    End If
End Sub
Samantha
Top achievements
Rank 1
 answered on 10 Jan 2011
1 answer
128 views
Hi Telerik,


I want to set width and behaviors of ImageManager in RadEditor, but I don't find any properties to change ImageManager look like


RadEditor1.ImageManager.Behaviors = WindowBehaviors.Move | WindowBehaviors.Close | WindowBehaviors.Maximize | WindowBehaviors.Resize;
RadEditor1.ImageManager.Width = Unit.Pixel(1366);


This problem is similar to FlashManager, DocumentManager, TemplateManager, MediaManager
Rumen Jekov
Top achievements
Rank 1
 answered on 10 Jan 2011
1 answer
112 views
Hello Rad-Community!

I´m trying to make the Grid support insert/update in a unlimited Category function based on a ID/ParentID structure. It´s very easy to make this work in one level scenario or where you know how deep things will go. It´s also very easy to just show an unlimited level structure WITHOUT insert/update. 

I havent found an example where it shows how this is done in an unlimited nested version.with insert/update function

Is there anyone out there that have made this and are willing to share an example.

/M
Mike Nogen
Top achievements
Rank 1
 answered on 09 Jan 2011
1 answer
127 views
Hi,

I'm using the example http://demos.telerik.com/aspnet-ajax/combobox/examples/programming/performance/defaultcs.aspx
and needed to make a change in case of webservice, but I have no idea how.

In the example listed webservice code checks the value of the information reported for the combobox and performs a filter on the database, I needed to make a filter using another combobox to check the values listed, as is being done?
msigman
Top achievements
Rank 2
 answered on 09 Jan 2011
2 answers
55 views
We are using a combination of RadToolBar as Command Item (http://demos.telerik.com/aspnet-ajax/toolbar/examples/applicationscenarios/gridcommanditem/defaultcs.aspx?product=grid) and custom styled edited rows (http://demos.telerik.com/aspnet-ajax/grid/examples/styles/editrowstyle/defaultcs.aspx) to display grid with users information.  Passwords are not displayed in the grid and are not available for editing, but we have to have password field available at the time of new user creation.  Any tips as to how we can make this happen?

Thank you!
Bogdan
Top achievements
Rank 1
 answered on 09 Jan 2011
2 answers
213 views

Hi,

I have a grid and  i used the sorting functionality. so if no records in grid and when i clicked on sorting it will fill the data to the grid.
Is there any way to disable sorting for a column header when there are no record in the grid. 

thanks
waruni
waruni
Top achievements
Rank 1
 answered on 09 Jan 2011
1 answer
47 views
I have a hierarchy grid and I want the master table to display a different color background if the underlying table has records. What is the best method for applying the formatting?
Mike Nogen
Top achievements
Rank 1
 answered on 09 Jan 2011
2 answers
276 views
Hi everyone and happy new year to all coders.

My problem is , I have a radgrid with custom paging, (based on Grid/Pager Template) i put a linkbutton and a textbox filter to load with data the radgrid 
When a write something to find in the textbox filter the radgrid it´s loaded correctly, the linkbutton it´s call one time.
When a click in the button (first, prev, next, last ) work ok to, but when I change the page size in the radcombox the RadGrid1_PageSizeChanged is called twice and if a write the number of the page in the RadNumericTextBox, the RadGrid1_PageIndexChanged it´s called one and then the LinkButton1_Click also.
Anyone can say what i am missing here?

I put here all the code.
Thank in advance.

Jolynice

ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="example.aspx.cs" Inherits="OralOffice_Pacientes_example" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
     <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
 
     <script type="text/javascript">
            var tableView = null;
            function pageLoad(sender, args) {
                tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
            }
 
            function RadComboBox1_SelectedIndexChanged(sender, args) {
                tableView.set_pageSize(sender.get_value());
            }
 
            function changePage(argument) {
                tableView.page(argument);
            }
 
            function RadNumericTextBox1_ValueChanged(sender, args) {
                tableView.page(sender.get_value());
            }
        </script>
 
    </telerik:RadScriptBlock>
 
            <!-- content start -->
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
 
            <div>
 
 
            <asp:Button ID="LinkButton1" runat="server"  Text="Find CompanyName" onclick="LinkButton1_Click">
            </asp:Button>  
            <input type="text" runat="server" name="fname" id="Text1"  style="width:370px;"/>
 
            </div>
 
            <telerik:RadGrid ID="RadGrid1" AllowPaging="true"
            DataSourceID="SqlDataSource1" runat="server" Skin="Vista"
            OnPageIndexChanged="RadGrid1_PageIndexChanged" onPagesizechanged="RadGrid1_PageSizeChanged">
                <MasterTableView>
                    <PagerTemplate>
                        <asp:Panel ID="PagerPanel" Style="padding: 6px; line-height: 24px" runat="server">
                            <div style="float: left">
                                <span style="margin-right: 3px;">Page size:</span>
                                <telerik:RadComboBox ID="RadComboBox1" DataSource="<%# new object[]{10, 20, 30, 40, 50} %>"
                                    Style="margin-right: 20px;" Width="40px" SelectedValue='<%# DataBinder.Eval(Container, "Paging.PageSize") %>'
                                    runat="server" OnClientSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
                                </telerik:RadComboBox>
                            </div>
                            <div style="margin: 0px; float: right;">
                                Displaying page
                                <%# (int)DataBinder.Eval(Container, "Paging.CurrentPageIndex") + 1 %>
                                of
                                <%# DataBinder.Eval(Container, "Paging.PageCount")%>
                                , items
                                <%# (int)DataBinder.Eval(Container, "Paging.FirstIndexInPage") + 1 %>
                                to
                                <%# (int)DataBinder.Eval(Container, "Paging.LastIndexInPage") + 1 %>
                                of
                                <%# DataBinder.Eval(Container, "Paging.DataSourceCount")%>
                            </div>
                            <div style="width: 400px; margin: 0px; padding: 0px; float: left; margin-right: 10px;
                                white-space: nowrap;">
                                <asp:Button ID="Button1" runat="server"  OnClientClick="changePage('first'); return false;"
                                    CommandName="Page" CommandArgument="First" Text="|<" CssClass="PagerButton FirstPage" />
                                <asp:Button ID="Button2" runat="server" OnClientClick="changePage('prev'); return false;"
                                    CommandName="Page" CommandArgument="Prev" Text=" <" CssClass="PagerButton PrevPage" />
                                <span style="vertical-align: middle;">Page:</span>
                                <telerik:RadNumericTextBox ID="RadNumericTextBox1" Width="25px" Value='<%# (int)DataBinder.Eval(Container, "Paging.CurrentPageIndex") + 1 %>'
                                    runat="server">
                                    <ClientEvents OnValueChanged="RadNumericTextBox1_ValueChanged" />
                                    <NumberFormat DecimalDigits="0" />
                                </telerik:RadNumericTextBox>
                                <span style="vertical-align: middle;">of
                                    <%# DataBinder.Eval(Container, "Paging.PageCount")%>
                                </span>
                                <asp:Button ID="Button3" runat="server" OnClientClick="changePage('next'); return false;"
                                    CommandName="Page" CommandArgument="Next" Text=" >" CssClass="PagerButton NextPage" />
                                <asp:Button ID="Button4" runat="server" OnClientClick="changePage('last'); return false;"
                                    CommandName="Page" CommandArgument="Last" Text=" >|" CssClass="PagerButton LastPage" />
                            </div>
                            <asp:Panel runat="server" ID="NumericPagerPlaceHolder" />
                        </asp:Panel>
                    </PagerTemplate>
                    <PagerStyle Mode="NumericPages" PageButtonCount="10" />
                </MasterTableView>
            </telerik:RadGrid>
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                ProviderName="System.Data.SqlClient"
                SelectCommand="SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City FROM Customers"
                runat="server"></asp:SqlDataSource>
            <!-- content end -->
    </div>
    </form>
</body>
</html>

C#
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class OralOffice_Pacientes_example : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            setdatasourceGrid();
            RadGrid1.DataBind();
        }
    }
 
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        setdatasourceGrid();
        RadGrid1.DataBind();
    }
 
 
    internal void setdatasourceGrid()
    {
        //To see the headers only
        if (String.IsNullOrEmpty(Text1.Value))
            SqlDataSource1.SelectCommand = "SELECT top 0 CustomerID, CompanyName, ContactName, ContactTitle  FROM  Customers ";
        //To see all records
        else if (Text1.Value.Equals("*"))
            SqlDataSource1.SelectCommand = "SELECT  CustomerID, CompanyName, ContactName, ContactTitle  FROM  Customers ";
        //filter
        else
            SqlDataSource1.SelectCommand = "SELECT CustomerID, CompanyName, ContactName, ContactTitle  FROM  Customers  WHERE  (CompanyName like  '%" + Text1.Value + "%')";
    }
 
 
    protected void RadGrid1_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)
    {
        RadGrid1.CurrentPageIndex = e.NewPageIndex;
        setdatasourceGrid();
        RadGrid1.DataBind();
    }
 
    protected void RadGrid1_PageSizeChanged(object source, Telerik.Web.UI.GridPageSizeChangedEventArgs e)
    {
        setdatasourceGrid();
        RadGrid1.DataBind();
    }
}

jolynice
Top achievements
Rank 1
 answered on 09 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?