Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
537 views

I feel I'm doing this the hard way, and I'm hoping you can set me straight. I have a grid with EditMode="PopUp" and EditFormType="Template". In this grid's FormTemplate, I have the following save image to click...

<asp:ImageButton ID="imgSave" runat="server" TabIndex="120" AlternateText="Save"
ImageUrl="~/images/icons/save-24.jpg" ToolTip="Save"
CommandName='<%# IIf (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>' />

Before it saves, I validate certain data. So in the grid's ItemDataBound event, I assign to the imgSave's "onclick" attribute a javascript function with various control ClientIDs in the popup. If certain conditions fail, javascript gives an alert and does "return false" to keep the popup from closing. If the data is good, I "return true" to let the popup close and refresh the grid's data. It works well.

Now this is where I've goofed up. What I want, is after the grid is rebound/refreshed, I want to highlight the edited row and display certain stats beneath the grid. I've written the code, but don't know how to call it. Is there an event I can tie to my javascript function? (I tried OnActiveRowChanged, but it didn't fire.)

To get around this, just before my "return true" that closes the popup form, I added these two lines of code...

var f = function() { UpdateStatusBar(iKey); };
setTimeout(f, 1000);
return true;

Having the 1 second delay gives the grid time to rebind/refresh before calling my UpdateStatusBar function, but that's open to timing issues. What should I do instead?

Tsvetoslav
Telerik team
 answered on 11 Dec 2010
1 answer
53 views
Hi,

Please help me out how to show full time in start date and end date in Edit Form By default it is showing from 8.00 Am to 5.00 Pm..
I want to show 24 hrs in that.

Thank u,
Ramanaidu.K
Veronica
Telerik team
 answered on 11 Dec 2010
1 answer
123 views
I found this article http://www.telerik.com/community/code-library/aspnet-ajax/grid/single-radiobutton-check-at-a-time-with-row-selection.aspx
and it helped me for a while. I made it working partially. The problem is that it does work only on a single page. If paging is applied on the listview and the selected radiobutton (on LOAD) is on the page #2 or higher it will be not unchecked.

How to make it works across all the pages in the ListView? Means if i select radiobutton on a page #5 and then go to page #2 and check new radiobutton the one from page #5 should be unchecked.

Thanks
Veli
Telerik team
 answered on 11 Dec 2010
2 answers
97 views
I have what I hope is a simple question, but I can't seem to find an example. I have the following object structure (for example):

public class Invoice
{
    public int InvoiceId { get; set; }
    public string CustomerName { get; set; }
    public double Total { get; set; }
 
    public List<InvoiceLineItem> LineItems { get; set;}
}
 
public class InvoiceLineItem
{
    public string Description { get; set; }
    public int Quantity { get; set; }
    public decimal Rate { get; set; }
    public decimal Total { get { return Quantity * Rate; } }
}

I want to bind a list of Invoice to this hierarchical grid using HierarchyLoadMode="Client" , preferably declaratively, and without hooking DetailTableDataBind (I have already solved it this way, but it seems there should be a much better way). Is there a way to express the relationship? All the data is preloaded and ready to be bound.

Current Solution:
protected void RadGridInvoices_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
{
    var invoices= e.DetailTableView.DataSource as IEnumerable<Invoice>;
 
    if (invoices != null)
    {
        string invoiceId =
e.DetailTableView.ParentItem.GetDataKeyValue("InvoiceId").ToString();
 
        var invoice = invoices.First(inv => inv.InvoiceId == invoiceId);
             
        e.DetailTableView.DataSource = invoice.LineItems;
    }
}


Thanks,
Mark Huber
Veli
Telerik team
 answered on 11 Dec 2010
1 answer
95 views

VS 2008
Telerik 2010.2.713.35

.rcbArrowCell {background-image: none !important;} works great in IE, but in FF and Safari, the image only partly disappears (a thin vertical line remains).  How can I make it invisible in FF and Safari?

Example below:

Page:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<style id="ThemeCSS" runat="server" type="text/css">
    </style>
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="Scriptmanager1" runat="server">
    </asp:ScriptManager>
    <div>
        <asp:Table ID="Table1" runat="server">
            <asp:TableRow ID="TableRow1" runat="server">
                <asp:TableCell ID="TableCell1" runat="server" BackColor="Red" Width="200px">
                    <telerik:RadComboBox ID="RadComboBox1" runat="server">
                    </telerik:RadComboBox>
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    </form>
</body>
</html>

Code:
Imports Telerik.Web.UI
Partial Class _Default
    Inherits System.Web.UI.Page
  
      
    Private Sub DisableArrow(ByVal cbo As RadComboBox)
        Dim cboID As String = "#" + cbo.ClientID
        Dim ltrl As New LiteralControl()
        ltrl.ID = "HideArrowCSS"
        ltrl.Text = cboID + " .rcbArrowCell {background-image: none !important; border: 0; padding: 0; width: 0px; background-color: Transparent;} "
  
        ThemeCSS.Controls.Add(ltrl)
    End Sub
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RadComboBox1.Height = 0
        RadComboBox1.Width = 0
        DisableArrow(RadComboBox1)
    End Sub
End Class
Sa_MMM
Top achievements
Rank 1
 answered on 11 Dec 2010
2 answers
265 views
Hello,

I really need to be able to programmatically create, and populate a hierarchical radgrid.

right now I am just working on two levels (master, one detail) and am trying to setup the load-on-demand functionality. I am getting the master to load, but when i try and expand a row, it just sits forever (with the statusbar doing something).

The query it is running for a row shouldn't take much longer than a second...  here is the code I am working with:

protected void Page_Load(object sender, EventArgs e)
    {
        _Grid.DetailTableDataBind += new GridDetailTableDataBindEventHandler(_Grid_DetailTableDataBind);
        _Grid.NeedDataSource +=new GridNeedDataSourceEventHandler(_Grid_NeedDataSource);
 
        LoadGrid();
    }
 
    void  _Grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        if (!e.IsFromDetailTable)
        {
            _Grid.DataSource = GetDataTable("county:zavala");
        }
    }
 
    void _Grid_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
    {
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
        switch (e.DetailTableView.Name)
        {
            case "PARENT":
                {
                    //string ID = dataItem.GetDataKeyValue("ID").ToString();
                    e.DetailTableView.DataSource = GetDataTable("county:zavala");
                    break;
                }
 
            case "CHILD":
                {
                    string cscpID = dataItem.GetDataKeyValue("cscpID").ToString();
                    e.DetailTableView.DataSource = GetDataTable("cscpID:" + cscpID + " view:WP");
                    break;
                }
        }
    }
 
    private SqlCommand QueryCommand(string Query)
    {
        SqlConnection conn = new SqlConnection(GetConnectionString("connTGS_"));
        SqlCommand cmd = new SqlCommand("tgs_.pd.NewQuery", conn);
        cmd.CommandType = CommandType.StoredProcedure;
 
        SqlParameter qry = cmd.Parameters.Add("@Query", SqlDbType.NVarChar, 2000);
        qry.Value = Query;
        SqlParameter iserror = cmd.Parameters.Add("@iserror", SqlDbType.Bit, 1);
        iserror.Value = false;
 
        return cmd;
    }
 
    private DataTable GetDataTable(string query)
    {
        SqlCommand cmd = QueryCommand(query);
        SqlDataAdapter dA = new SqlDataAdapter(cmd);
        DataTable dT = new DataTable();
        dA.Fill(dT);
 
        return dT;
    }
 
    private void LoadGrid()
    {
        if (!Page.IsPostBack)
        {
            _Grid.PageSize = 20;
            _Grid.AllowPaging = true;
            _Grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
            _Grid.AutoGenerateColumns = false;
            _Grid.ShowStatusBar = true;
 
            _Grid.ClientSettings.AllowColumnsReorder = true;
            _Grid.ClientSettings.AllowDragToGroup = true;
            _Grid.ClientSettings.AllowColumnHide = true;
 
            InitRootBand(ref _Grid);
            InitChildBand(ref _Grid);
        }
        _radAjaxMan.AjaxSettings.AddAjaxSetting(_Grid, _Grid);
    }
 
 
    private void InitRootBand(ref RadGrid grid)
    {
        //grid.DataMember = "PARENT";
        grid.MasterTableView.DataKeyNames = new string[] { "id" };
 
        grid.Columns.Add(newColumn("id", "ID", "id", null, false));
        grid.Columns.Add(newColumn("cid", "cID", "p_cID", null, false));
        grid.Columns.Add(newColumn("opid", "opID", "p_opID", null, false));
        grid.Columns.Add(newColumn("CompanyName", "Company Name", "p_CompanyName", null, false));
    }
 
    private void InitChildBand(ref RadGrid grid)
    {
        GridTableView tableWP = new GridTableView(grid);
        grid.MasterTableView.DetailTables.Add(tableWP);
 
        //tableWP.DataMember = "CHILD";
        tableWP.Name = "CHILD";
        tableWP.DataKeyNames = new string[] { "cscpID" };
 
        tableWP.Columns.Add(newColumn("ID", "ID", "ID", null, false));
        tableWP.Columns.Add(newColumn("cscpID", "cscpID", "cscpID", null, false));
        tableWP.Columns.Add(newColumn("cid", "cID", "c_cID", null, false));
         
        tableWP.Columns.Add(newColumn("FirstMonth", "First Month", "c_FirstMonth", "{0:MMM-yy}", false));
 
        GridRelationFields drMain = new GridRelationFields();
 
        drMain.MasterKeyField = "id";
        drMain.DetailKeyField = "cscpID";
        tableWP.ParentTableRelation.Add(drMain);
    }
 
    private GridBoundColumn newColumn(string fieldName, string headerText, string Key, string format, bool hidden)
    {
        GridBoundColumn fld = new GridBoundColumn();
        fld.DataField = fieldName;
        fld.DataFormatString = format;
        fld.HeaderText = headerText;
        fld.Display = !hidden;
        return fld;
    }


Please, any help is appreciated!  Getting past this road block is crucial!
Felipe
Top achievements
Rank 1
 answered on 11 Dec 2010
3 answers
74 views
Good day,
Please can someone help me with this:

I have a following code in my aspx page:

<

 

telerik:GridTemplateColumn HeaderText ="Eis-Id" UniqueName ="PRICol" Groupable="true" DataField="FILENO" SortExpression="FILENO" ReadOnly="true" HeaderButtonType="TextButton">

 

 

<HeaderStyle Width="70px" />

 

 

<ItemStyle Width="70px" />

 

 

<ItemTemplate>

 

 

<asp:Label ID="PRI" runat="server" ></asp:Label>

 

 

<asp:Image ID="Image1" runat="server" AlternateText="EIS CHARGES" />

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

When I exporting to PDF Alternate text appear on my pdf report.I need only PRI to be on the report.

Thanks so much..

 

Daniel
Telerik team
 answered on 10 Dec 2010
7 answers
252 views
Hi,

I have a RadGrid and a RadComboBox. For one Command Item click I am using AJAX to update RadComboBox. So I have linked RadGrid and RadCombobox using AJAX Manager from Design view(Configure AJAX Manager).

My RadGrid has Edit , Delete Reset function which has no connection to RadCombobox. Whenever I click anyone it updated RadComcbox too. How can I solve this problem ?

Please Help...
Smiely
Top achievements
Rank 1
 answered on 10 Dec 2010
4 answers
441 views
Hello Team,

I have searched over the forum to get a solution but I am finding my issue is quite different than what I have found so far.

I have grid of users that will be selected with a clientselectcolumn and I have a separate template column of checkboxs that I want to set only one of the selected users as the main user or admin user. I need help to achieve the following:

1. Client side validation to allow only one checkbox to be selected at a time for the admin user when a checkbox is selected.

2.  Persist the checked state of checked box upon paging or sorting.

Could you please point me in to some sources or provide me with pointers.

Thank you.
-G-
Rafaga2k
Top achievements
Rank 1
 answered on 10 Dec 2010
6 answers
180 views
Hi,

Is there a way, I can reduce the height for the spell dialog? I have to open that inside a RadPane (height is around 300) in a RadSplitter, so I need to reduce the size.

Thanks
kachy
Top achievements
Rank 1
 answered on 10 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?