Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
494 views
I have databinded my gridview  from a particular linq statement which populates certain values from a table.

I need to show a different name when the gridview populates

for eg. instead of saying true(which it says in the database ) I need it to say Active.

I cannot change the database.

        protected void rgUsers_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.Cells[0].Text == "false") 
                { 
                    e.Row.Cells[0].Text = "Inactive"; 
                }
                else
                    if (e.Row.Cells[0].Text == "true")
                    {
                        e.Row.Cells[0].Text = "Active";
                    }
            }
        }
    }
}
Shinu
Top achievements
Rank 2
 answered on 25 Feb 2014
5 answers
182 views
Hi ,

I want to add a menu  item to my radmenu.
Currently the menu is getting populated from a sitemap. i want to keep that as it is and add a new item to the menu.
I can NOT add the new menu item to sitemap as it is a div so i need to have it in a itemtemplate.

The new item would be say Language with some thing like-
 <telerik:RadMenuItem Text="Language">
              <Items>
                  <telerik:RadMenuItem>
                      <ItemTemplate>
                          <div>
                              English
                      <br />
                              French
                          </div>
                      </ItemTemplate>
                  </telerik:RadMenuItem>
              </Items>
          </telerik:RadMenuItem>


Could any one help me on this , how can we achieve this , with a small piece of sample code

Thanks 

Kate
Telerik team
 answered on 25 Feb 2014
3 answers
206 views

I have 2 grids, each pointing to a datatable. The second table has to be filtered based on the row selection of first grid, so when you click a row on the first grid, in its SelectedIndexChanged event, it filters the second table to a view, converts that to a table, sets it to the 2nd grid's DataSource, and rebinds it. Works fine.

Now when the user clicks a button, I update the data server-side and want to update both grids without a page refresh. After data update, back in javascript, I rebind the first grid via get_masterTableView().rebind(). It updates fine. I then rebind the second grid the same way, but it causes a page refresh. I've no idea why and it's messes up everything.

So I stopped rebinding the second grid in javascript and thought I'd select a row in javascript after the first grid's rebind via .set_selected(true). That works. However, it does not call the SelectedIndexChanged event on the server, which I need to properly update the second grid. So either...

1) I need get_masterTableView().rebind() on the second grid to not update the entire page like the first grid.
2) Or I need to call SelectedIndexChanged to trigger after I select it in javascript with .set_selected

What do you recommend? And how can it be done? Chunks of my code are below...




    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="grdPODetails">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grdPODetails" />
                    <telerik:AjaxUpdatedControl ControlID="pnlChild" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="grdReceiving">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlChild" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    



                        <telerik:RadGrid ID="grdPODetails" runat="server" AllowSorting="True" AutoGenerateColumns="False" GridLines="None">
                            <HeaderContextMenu EnableAutoScroll="True">
                            </HeaderContextMenu>

                            <ClientSettings EnablePostBackOnRowClick="true">
                                <Selecting AllowRowSelect="True" />
                            </ClientSettings>

                            <MasterTableView Caption="Purchase Order Detail Information" CommandItemDisplay="None"
                                    ClientDataKeyNames="PurchaseOrderDetailKey" DataKeyNames="PurchaseOrderDetailKey">
                                <CommandItemSettings ShowRefreshButton="False" />
                                <NoRecordsTemplate>
                                    No detail lines to display.
                                </NoRecordsTemplate>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="ChartOfAccountNumber" HeaderText="Acct Number" UniqueName="ChartOfAccountNumber">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="PurchaseOrderDetailDescription" HeaderText="Description" UniqueName="PurchaseOrderDetailDescription">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Catalogue" HeaderText="Catalogue" UniqueName="Catalogue">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="CostCenterID" HeaderText="Cost Center" UniqueName="CostCenterID">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridNumericColumn DataField="PurchaseOrderDetailQuantity" HeaderText="Quantity"
                                        UniqueName="PurchaseOrderDetailQuantity" DataFormatString="{0:N4}" DataType="System.Double">
                                    </telerik:GridNumericColumn>
                                    <telerik:GridNumericColumn DataField="UnitPrice" HeaderText="Unit Price" UniqueName="UnitPrice"
                                        DataFormatString="{0:N4}" DataType="System.Double">
                                    </telerik:GridNumericColumn>
                                    <telerik:GridBoundColumn DataField="UnitDescription" HeaderText="Unit Desc" UniqueName="UnitDescription">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridNumericColumn DataField="PurchaseOrderDetailAmount" HeaderText="Amount"
                                        UniqueName="PurchaseOrderDetailAmount" DataFormatString="{0:N2}" DataType="System.Double">
                                    </telerik:GridNumericColumn>
                                    <telerik:GridNumericColumn DataField="PurchaseOrderDetailBalance" HeaderText="Balance"
                                        UniqueName="PurchaseOrderDetailBalance" DataFormatString="{0:N2}" DataType="System.Double">
                                    </telerik:GridNumericColumn>

                                    <telerik:GridCheckBoxColumn DataField="ReceivingProcessed" HeaderText="Receiving Processed" UniqueName="ReceivingProcessed" DataType="System.Boolean">
                                        <HeaderStyle Width="70px" />
                                        <ItemStyle Width="70px" />
                                    </telerik:GridCheckBoxColumn>
                                    <telerik:GridCheckBoxColumn DataField="InvoiceProcessed" HeaderText="Invoice Processed" UniqueName="InvoiceProcessed" DataType="System.Boolean">
                                        <HeaderStyle Width="70px" />
                                        <ItemStyle Width="70px" />
                                    </telerik:GridCheckBoxColumn>
                                    <telerik:GridNumericColumn DataField="PurchaseOrderDetailKey" HeaderText="PurchaseOrderDetailKey"
                                        UniqueName="PurchaseOrderDetailKey" DataType="System.Int32" Visible="False" ReadOnly="True">
                                    </telerik:GridNumericColumn>

                                </Columns>

                            </MasterTableView>
                        </telerik:RadGrid>






                        <asp:Panel ID="pnlChild" runat="server">

                            <telerik:RadGrid ID="grdReceiving" runat="server" AllowSorting="True" AutoGenerateColumns="False" GridLines="None">
                                <HeaderContextMenu EnableAutoScroll="True">
                                </HeaderContextMenu>

                                <ClientSettings>
                                    <Selecting />
                                    <ClientEvents OnRowDblClick="RowDblClick"
                                        OnPopUpShowing="centerFormPopUp" />
                                </ClientSettings>

                                <MasterTableView Caption="Receiving Information" CommandItemDisplay="Bottom" EditMode="PopUp"
                                        ClientDataKeyNames="ReceivingKey,ReceivedInFullStatusLkUpKey" DataKeyNames="ReceivingKey,ReceivedInFullStatusLkUpKey">
                                    <CommandItemSettings ShowRefreshButton="False" AddNewRecordText="Add New" AddNewRecordImageUrl="~/images/icons/addslim-16.png" />
                                    <NoRecordsTemplate>
                                        No detail lines to display.
                                    </NoRecordsTemplate>
                                    <Columns>
                                        <telerik:GridEditCommandColumn UniqueName="EditColumn">
                                        </telerik:GridEditCommandColumn>
                                        <telerik:GridBoundColumn HeaderText="Status" UniqueName="ReceivingStatus">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="ReceivedInFullStatusLkUpKey" Visible="false" HeaderText="ReceivedInFullStatusLkUpKey" UniqueName="ReceivedInFullStatusLkUpKey">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridNumericColumn DataField="ReceivedQuantity" HeaderText="Quantity"
                                            UniqueName="ReceivedQuantity" DataFormatString="{0:N4}" DataType="System.Double">
                                        </telerik:GridNumericColumn>
                                        <telerik:GridBoundColumn DataField="Comments" HeaderText="Comments" UniqueName="Comments">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridCheckBoxColumn DataField="Asset" HeaderText="Asset" UniqueName="Asset" DataType="System.Boolean" DefaultInsertValue="false">
                                            <HeaderStyle Width="70px" />
                                            <ItemStyle Width="70px" />
                                        </telerik:GridCheckBoxColumn>

                                        <telerik:GridDateTimeColumn DataField="ReceivedDate" HeaderText="Rec Date" UniqueName="ReceivedDate"
                                            DataFormatString="{0:MM/dd/yyyy}">
                                        </telerik:GridDateTimeColumn>

                                        <telerik:GridBoundColumn DataField="UserID" HeaderText="Rec By User" UniqueName="UserID">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="InvoiceNumber" HeaderText="Inv Num" UniqueName="InvoiceNumber">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridNumericColumn DataField="ReceivingKey" HeaderText="ReceivingKey"
                                            UniqueName="ReceivingKey" DataType="System.Int32" Visible="False" ReadOnly="True">
                                        </telerik:GridNumericColumn>

                                        <telerik:GridButtonColumn CommandName="Delete"
                                            ConfirmText="Are you sure you want to delete the selected item?" Text="Delete" 
                                            UniqueName="Delete">
                                        </telerik:GridButtonColumn>

                                    </Columns>

                                </MasterTableView>
                            </telerik:RadGrid>
                        
                        </asp:Panel>







    Protected Sub grdPODetails_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles grdPODetails.SelectedIndexChanged

        Dim iRow As Integer = grdPODetails.MasterTableView.GetSelectedItems(0).ItemIndex
        Dim item As GridDataItem = grdPODetails.MasterTableView.Items(iRow)
        Dim iPODetailKey As Integer = CType(item.GetDataKeyValue(FLDS.PurchaseOrderDetailKey.ToString).ToString, Integer)

        Dim dv As DataView = New DataView(Receivings)
        dv.RowFilter = "PurchaseOrderDetailKey=" & iPODetailKey
        grdReceiving.DataSource = dv.ToTable
        grdReceiving.Rebind()

    End Sub



Eyup
Telerik team
 answered on 25 Feb 2014
4 answers
288 views
Hello
I have 2 problems with RadFileExplorer in thubnails view.

1)
My file are stored in a SQLServer database and i use a DBDataServer for retrive data and a handler.ashx for get the current context and response a bitestream to client.. ..but.. it is all correct for a 'normal' PC browser, using a iPad the file will be displayer over the current page and i dont want it !

I need a window.open (in a new page). I have tried all possibles internet solution but i dont have a correct solution.

2)
I nedd a custom FileList.ListView.ClientSettings.DataBinding.ItemTemplate to show other file information but never want to work.. see item.Description

//                var itemTemplate = @"<li class=""rfeThumbList rlvI"">
//                        <a href=""javascript:%open%;"" class=""rfeLink rlvDrag#= isSelected ? ' rfeSelectedLink' : ''#"" data-index=""#= index #"" title=""#= Name #"">
//                            <span class=""rfeFile#= Telerik.Web.UI.FileExplorerHelper.isWebImage(item.Extension) ? ' rfeImageFile' : '' #"">
//                            # if(Telerik.Web.UI.FileExplorerHelper.isWebImage(item.Extension)) {#
//                                <img src=""%default%"" alt=""#= Name #"" width=""32"" height=""32"" />
//                            # } else { #
//                                <span class=""rfeFileIcon #= Telerik.Web.UI.FileExplorerHelper.getThumbnailCSSExtension(item) #""></span>
//                            # } #
//                            </span>
//                            <span class=""rfeThumbTitle"">#= Name #</span>
//                        </a>      
//                        <span class=""rfeThumbTitle"">#= item.Description #</span>                  
//                    </li>";


THX
Vessy
Telerik team
 answered on 25 Feb 2014
1 answer
493 views
Hi

Is it possible to have a fixed first and last column and the mid- columns could be scrollable horizontally.

Any suggestions would be appreciated.

Thanks
Princy
Top achievements
Rank 2
 answered on 25 Feb 2014
2 answers
139 views
I need to create a grid like the one in the attached image.  I think that the Grid control is the appropriate control but I'm not sure how to make to it look like the mock up. I need to match the look of the mock up as closely as possible.

I think using column grouping will be how I can make the columns have subcolumns (as indicated by the red box in the attached image).

I'm not certain but I think that a NestedViewTemplate is what is needed to create groups of rows (as indicated by the green box in the attached image). My only concern is that the resulting grid needs to show all of the data. The expand/collapse functionality is not desired.

Also, footer rows with grand totals need to be displayed for each of the groups in the NestedViewTemplate (as indicated by the cyan box in the attached image).

Is the grid control the right tool for the job? Am I on the right path in trying to use the grid as I've described above to match the grid in the attached image?

Thanks!
Aaron
Top achievements
Rank 1
 answered on 25 Feb 2014
2 answers
154 views
Hello Team,

In my project i have implement the show image on selected page after page load.
i tried from javascript, but it don't help me because when the page load image automatically hide.

My  code is that on tabclick 
 <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="VISTA" AutoPostBack="true"
                                OnTabClick="RadTabStrip1_TabClick" EnableEmbeddedSkins="false" OnClientTabSelected="OnClientTabSelected1">
                            </telerik:RadTabStrip>

 protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
    {
      
        Session["TabIdValue"] = RadTabStrip1.SelectedTab.Value;
       
        RadTabStrip1.SelectedTab.ImageUrl = "images/arrow-on.png";
       // PopulateTreeView(RadTabStrip1.SelectedTab.Value);
        string sConn = AppSettings.GetItem("ConnectionString");

        string TabId = RadTabStrip1.SelectedTab.Text;
        DataTable dt = new DataTable("BNet_NavigationMaster_TB");
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter("select * from BNet_NavigationMaster_TB ", sConn);
        da.Fill(dt);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (TabId == dt.Rows[i]["text"].ToString())
            {
                Response.Redirect(ConfigurationManager.AppSettings["PagePath"] + dt.Rows[i]["filepath"].ToString());
            }
        }
Shinu
Top achievements
Rank 2
 answered on 25 Feb 2014
10 answers
285 views
Is it possible to export each page of the radgrid to each page of the exported pdf? If it is possible can you give me an example?
Princy
Top achievements
Rank 2
 answered on 25 Feb 2014
1 answer
408 views
Hi,
I am trying to set filter true on two gridbound columns of the radgrid which has dataformatstring to it. But the filtering doesnt seem to work. Here is the code for the columns. This should be something simple but still couldn't find out. Really appreciate some help. Thanks.

Filter works fine in the first one.
=======================
<telerik:GridBoundColumn DataField="divName" DataType="System.String" HeaderText="Division Of Admin"
                        Visible="true" HeaderStyle-Width="13%" FilterControlWidth="65%" SortExpression="divName"
                        UniqueName="divName" AllowFiltering="true" AutoPostBackOnFilter="true" ShowFilterIcon="false">
                    </telerik:GridBoundColumn>

Filter doesnt work
==============
 <telerik:GridBoundColumn DataField="eventDt" DataFormatString="{0:MM-dd-yyyy}" HeaderText="Event Date" Visible="true" HeaderStyle-Width="15%"
                    FilterControlWidth="65%" SortExpression="eventDt" UniqueName="eventDt" AllowFiltering="true" AutoPostBackOnFilter="true" ShowFilterIcon="false">
</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="startTime" DataFormatString="{0:t}" HeaderText="Event Time" Visible="true" HeaderStyle-Width="15%"
                        FilterControlWidth="65%" SortExpression="startTime" UniqueName="startTime" AllowFiltering="true" AutoPostBackOnFilter="true" ShowFilterIcon="false">
                    </telerik:GridBoundColumn>
Princy
Top achievements
Rank 2
 answered on 25 Feb 2014
10 answers
2.6K+ views
Hi
 How to close rad window from server side click event ?.From main page button click event i open Rad Window ,and in that i use three text boxes,if all text boxes having value ,it will store in database and close that rad window,if any one text box is empty rad window not close and show the error msg.

My code is :

In Client Side Code:

   function CloseAndRedirect(sender, args) {
            GetRadWindow().BrowserWindow.location.href = 'Default1.aspx';        //Redirect to new url 
            GetRadWindow().close();       //closes the window       
        }

        function GetRadWindow()   //Get reference to window    
        {
            var oWindow = null;
            if (window.radWindow)
                oWindow = window.radWindow;
            else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow;
            return oWindow;
        }

Server Side Code :

 Protected Sub btnSendMail_Click(sender As Object, e As EventArgs) Handles btnSendMail.Click
             If (txtName.Text = "" or txtcompany.Text="" or txtphone.Text="" ) Then

                      ShowMessage("enter all values")

            Else
             'Dim script As String = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(CloseAndRedirect);</script>"
            'ClientScript.RegisterStartupScript(Me.GetType(), "Close", script)

            Dim script As String = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(CloseAndRedirect());</script>"
            RadScriptManager.RegisterStartupScript(Me, Me.GetType(), "CloseAndRedirect()", script, False)

    End Sub

I try both in else block ,but both not work.it show error like "0x800a1391 - Microsoft JScript runtime error: 'Sys' is undefined".

My need is close the rad window when  server side button click event in and stay in main page

Pls Reply asap.......
    Regards
        Aravind
Shinu
Top achievements
Rank 2
 answered on 25 Feb 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?