Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
1.2K+ views
Is it possible to alter the time picker times?  I'd like to have it selectable in 15 minute intervals rather than 1 hour.

Ryan
Graham
Top achievements
Rank 1
 answered on 24 Aug 2011
1 answer
186 views
I have a grid with a column that is bound to a text field. This text is usually a number, but is sometimes a "-" character.

When exporting to Excel, I would like for the numbers to display with a single digit after the decimal point. So integers are displayed as #.0... (100.0 for example). I have the following style declaration:

Dim pctStyle As New Telerik.Web.UI.GridExcelBuilder.StyleElement("PctStyle")
pctStyle.AlignmentElement.HorizontalAlignment = GridExcelBuilder.HorizontalAlignmentType.Right
pctStyle.NumberFormat.FormatType = GridExcelBuilder.NumberFormatType.GeneralNumber
pctStyle.NumberFormat.Attributes("ss:Format") = "0.0"


It doesn't seem to work. The exported Excel file always shows 100 as 100, not 100.0.

I am wondering if this is because the underlying grid column data field is text? Is there any way to format the numeric output of a grid column that isn't bound to a numeric field?
Princy
Top achievements
Rank 2
 answered on 24 Aug 2011
1 answer
234 views
Hi,

I want to create a RadComboBox using javascript and add it to the div. Is it possible to create it dynamically at client site?
 
CODE
 if (columnName.toUpperCase() == "ORDER") {
                //Create ComboBox
                var radComboBox = new RadComboBox();
                radComboBox.id = "RadCBox" + ID;
                AddItemsToComboBox(radComboBox, orders);


               var divTag = document.getElementById("dynID");
               divTag.appendChild(radComboBox);
                
            }


Thanks,
Prava
Princy
Top achievements
Rank 2
 answered on 24 Aug 2011
1 answer
103 views
Is there any way to disable the SelectAll functionality of a SelectColumn checkbox in the header of a NESTED Table View.

GridHeaderItem item = RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;

does it for the main grid but how do I access the Header in the Details Table?

Jayesh Goyani
Top achievements
Rank 2
 answered on 23 Aug 2011
5 answers
140 views
Hello!

I've spent couple of hours trying to figure out how to delete, update or insert data into database via RadGrid. Could you point me out what I'm doing wrong. What I'd like to accomplish is to edit the data via EditForm, insert data via "Add New Record" Command and delete the data.

I've been going through Telerik's documentation, but I'm totally lost.

Codefront:
<telerik:RadGrid ID="gvKontakti" runat="server" AllowPaging="True" AllowSorting="True"
    AutoGenerateColumns="False"
    CellSpacing="0" GridLines="None"
    OnUpdateCommand="gvKontakti_UpdateCommand" Skin="Default"
    onDeletecommand="gvKontakti_DeleteCommand"
    oninsertcommand="gvKontakti_InsertCommand">
    <MasterTableView DataKeyNames="idKontakt" CommandItemDisplay="TopAndBottom">
        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
            </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn UniqueName="Kontakt" DataField="Naziv" HeaderText="Kontakt">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Funkcija" HeaderText="Funkcija" DataField="Funkcija">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Tel1" HeaderText="Telefon 1" DataField="Tel1">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Tel2" HeaderText="Telefon 2" DataField="Tel2">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Mob1" HeaderText="Mobitel 1" DataField="Mob1">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Mob2" HeaderText="Mobitel 2" DataField="Mob2">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Email1" HeaderText="E-mail 1" DataField="E-mail1">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Email2" HeaderText="E-mail 2" DataField="E-mail2">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Fax" HeaderText="Fax" DataField="Fax">
            </telerik:GridBoundColumn>
            <telerik:GridButtonColumn ConfirmText="Obrisati ovog korisnika?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Brisanje" ButtonType="ImageButton" CommandName="Delete" />
        </Columns>
        <EditFormSettings EditFormType="Template">
            <EditColumn UniqueName="EditColumn">
            </EditColumn>
            <FormTemplate>
                <table>
                    <tr>
                        <td>
                            Ime:
                        </td>
                        <td>
                            <asp:TextBox ID="txtIme" runat="server" Text='<%# Bind("Ime") %>'></asp:TextBox>
                        </td>
                        <td>
                            Prezime:
                        </td>
                        <td>
                            <asp:TextBox ID="txtPrezime" runat="server" Text='<%# Bind("Prezime") %>'></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Funkcija:
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="txtFunkcija" runat="server" Width="430px" Text='<%# Bind("Funkcija") %>'></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Telefon 1:
                        </td>
                        <td>
                            <asp:TextBox ID="txtTel1" runat="server" Text='<%# Bind("Tel1") %>'></asp:TextBox>
                        </td>
                        <td>
                            Telefon 2:
                        </td>
                        <td>
                            <asp:TextBox ID="txtTel2" runat="server" Text='<%# Bind("Tel2") %>'></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Mobitel 1:
                        </td>
                        <td>
                            <asp:TextBox ID="txtMob1" runat="server" Text='<%# Bind("Mob1") %>'></asp:TextBox>
                        </td>
                        <td>
                            Mobitel 2:
                        </td>
                        <td>
                            <asp:TextBox ID="txtMob2" runat="server" Text='<%# Bind("Mob2") %>'></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Fax:
                        </td>
                        <td>
                            <asp:TextBox ID="txtFax" runat="server" Text='<%# Bind("Fax") %>'></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            E-mail 1:
                        </td>
                        <td>
                            <asp:TextBox ID="txtEmail1" runat="server" Text='<%# Bind("Email1") %>'></asp:TextBox>
                        </td>
                        <td>
                            E-mail 2:
                        </td>
                        <td>
                            <asp:TextBox ID="txtEmail2" runat="server" Text='<%# Bind("Email2") %>'></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Adresa 1:
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="txtAdresa1" runat="server" Width="430px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Adresa 2:
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="txtAdresa2" runat="server" Width="430px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Adresa 3:
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="txtAdresa3" runat="server" Width="430px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Grad:
                        </td>
                        <td>
                            <asp:TextBox ID="txtGrad" runat="server"></asp:TextBox>
                        </td>
                        <td>
                            PoÅ¡tanski broj:
                        </td>
                        <td>
                            <asp:TextBox ID="txtPBR" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Država:
                        </td>
                        <td>
                            <asp:TextBox ID="txtDrzava" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            BiljeÅ¡ke:
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="txtBiljeske" runat="server" Width="455px" Height="200px" TextMode="MultiLine"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Aktivan korisnik:
                        </td>
                        <td colspan="3">
                            <asp:CheckBox ID="chkAktivan" runat="server" Checked='<%# Bind("Aktivan") %>' />
                        </td>
                    </tr>
                </table>
                <asp:Button ID="btnUpdate" CommandName="Update" Text="Update" runat="server" />
                <asp:Button ID="btnDelete" CommandName="Delete" Text="Delete" runat="server" />
            </FormTemplate>
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

Codebehind:

protected void Page_Load(object sender, EventArgs e)
{
    var kontakti = BindContacts();
    gvKontakti.DataSource = kontakti;
    gvKontakti.DataBind();
}
 
public object BindContacts()
{
    TSEntities db = new TSEntities();
    var kontakti = from k in db.Kontakts
                   select new { k.idKontakt, Naziv = k.Ime + " " + k.Prezime, Funkcija = k.Funkcija, k.Ime, k.Prezime, k.Tel1, k.Tel2, k.Mob1, k.Mob2, k.Email1, k.Email2, k.Fax, k.Aktivan };
 
    return kontakti;
}
 
protected void gvKontakti_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    TSEntities db = new TSEntities();
 
    if (e.CommandName == RadGrid.UpdateCommandName)
    {
        if (e.Item is GridEditFormItem)
        {
            GridEditFormItem item = (GridEditFormItem)e.Item;
            int idKontakt = Convert.ToInt32(item.GetDataKeyValue("IdKontakt"));
 
            if (idKontakt > 0)
            {
                Kontakt kontakt = new Kontakt();
                kontakt = db.Kontakts.SingleOrDefault(k => k.idKontakt == idKontakt);
 
                TextBox txtIme = (TextBox)item.FindControl("txtIme");
                TextBox txtPrezime = (TextBox)item.FindControl("txtPrezime");
 
                kontakt.Ime = txtIme.Text;
                kontakt.Prezime = txtPrezime.Text;
                db.SaveChanges();
 
                gvKontakti.Rebind();
            }
        }
    }
}
 
protected void gvKontakti_DeleteCommand(object sender, GridCommandEventArgs e)
{
    TSEntities db = new TSEntities();
    Kontakt kontakt = new Kontakt();
 
    int idKontakt = (int)((GridDataItem)e.Item).GetDataKeyValue("IdKontakt");
 
    kontakt = db.Kontakts.SingleOrDefault(k => k.idKontakt == idKontakt);
 
    if (kontakt != null)
    {
        db.Kontakts.DeleteObject(kontakt);
        try
        {
            db.SaveChanges();
        }
        catch (System.Exception)
        {
             
        }
    }
 
}
 
protected void gvKontakti_InsertCommand(object sender, GridCommandEventArgs e)
{
    TSEntities db = new TSEntities();
}


Any help would be appreciated.

Elliott
Top achievements
Rank 2
 answered on 23 Aug 2011
2 answers
107 views
Hello,

I have a custom appointment with custom tooltips.  On the tooltip there is a rad button that when clicked updates the table that drives the scheduler.  When the button is clicked and the DB is updated i would like to have the schedule update the appointments at the same time.  I have been unable to accomplish this.  Can you point me in the right direction?

Thanks,

Michael.
Michael Constantine
Top achievements
Rank 1
 answered on 23 Aug 2011
2 answers
295 views
Hi,

I am using RAD DatePicker control from a licenced version of telerik cotnrols.
I had to allow the user to choose dates only after 14 days.hence I ahd set
txtdtcontrol.Mindate=Today.AddDays(14)

This should have applied only for choosing the dates.But it is considering this case for getting the date from the database and assigning it to the field also and this is the issue.

Please help solve this problem.How shall I set the calender popup to disable dates lesser than 14 days from now but does not affect for assigning the values to the selectedDate property of the control.

Is it possible to disable dates just on the popup and not to the textbox value as such.
Sachidananda
Top achievements
Rank 1
 answered on 23 Aug 2011
7 answers
167 views
In my tree I have a root node that all other nodes fall under.  I want this to act as a header and have different styles (background image, hover effect, etc..) than the rest of the tree. Is this possible and what classes would I use to achieve this?
Ivan Zhekov
Telerik team
 answered on 23 Aug 2011
1 answer
77 views
Hi. I've loved Telerik's products for some years now; best of breed with great support :)

Any chance the SAK can include the entire Telerik r.a.d. library of controls when it's released? It would sure make life easier for us SharePoint 2010 developers.

Also, any update on a release date? You're keeping us all in suspense!

Thanks and keep up the great work :)

P.S. Whether these other controls are included or not, we're all looking forward to the SAK.
Sebastian
Telerik team
 answered on 23 Aug 2011
3 answers
125 views
Hi

I have a Grid with NestedView Table which I create programmatically. 
Each row on the child table has a checkbox field which selects the whole row.
It has a custom Command header with an Image Button which is acting like an "Add to Cart" button.

When the button is clicked, I can access the selected child items like so:

if (e.CommandName == "AddToCart")
{
  if (RadGrid1.SelectedIndexes.Count == 0)
  {
     RadWindowManager1.RadAlert("No documents have been selected", 250, 100, "Add to Document Cart", "");
     return;
  }
  GridCommandItem Item = (GridCommandItem)e.Item;
  ImageButton btnAddToCart = (ImageButton)e.Item.FindControl("btnAddSelectedToCart");
  System.Collections.ArrayList doclist = new System.Collections.ArrayList();
  foreach (GridDataItem item in RadGrid1.SelectedItems)
  {
    doclist.Add(new HRTDocData(Convert.ToInt32(item["RecordID"].Text), Convert.ToInt32(item["DocID"].Text), item["DocTypes"].Text, item["DocReferences"].Text, item["DocContents"].Text));
  }
        }

I actually need to make a javascript call to some existing code with the list of selected items.  I have tried to access the same information from the client side but it isnt working - I just get null values - or not selected???
This is my js function
function GetChildValues() {
    var grid = $find("<%=RadGrid1.ClientID %>");
    var MasterTable = grid.get_masterTableView();
    var selectedRows = MasterTable.get_selectedItems();
    for (var i = 0; i < selectedRows.length; i++) {
        var row = selectedRows[i];
        var cell = MasterTable.getCellByColumnUniqueName(row, "RecordID")
        alert(cell); 
    }

What am I missing please?


 

Simon
Top achievements
Rank 1
 answered on 23 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?