Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
577 views
I am wanting to create custom Display, Insert, and Edit templates. I need to do all this through code behind, I have no access to the aspx page.

I found a few posts getting me part of the way there:

I am having trouble figuring out how to add the HTML elements below to the scheduler, through code-behind.

<AppointmentTemplate>  
    (<asp:Literal ID="AppointmentStartTime" runat="server" Text='<%# Eval("Start", "{0:t}") %>'></asp:Literal>  
    -   
    <asp:Literal ID="AppoitmentEndTime" runat="server" Text='<%# Eval("End", "{0:t}") %>'></asp:Literal>)   
    <asp:Literal ID="AppointmentSubject" runat="server" Text='<%# Eval("Subject") %>'></asp:Literal>  
</AppointmentTemplate> 

Any help is appreciated. Thanks!
Joe
Top achievements
Rank 1
 answered on 29 Dec 2009
2 answers
256 views
I am trying to set focus on a radtextbox using the following function called on the ClientEvents-OnBlur event:
The problem is that when I remove the text and tab away, focus is not set. If I continue tabbing back to that field the onblur event fires again but it does set focus.  Why is this failing on my first onBlur event being fired and successful on the second onBlur event firing?


  function ValidateTitle(oTitle, args) {
    if (oTitle.get_value()=='') {
     oTitle.focus();
      }
  }  

<telerik:RadTextBox
 ID="txtTitle"
 runat="server"
 Rows="3"
 TextMode="MultiLine"
 Width="362px"
 MaxLength="4000"
 ToolTip="Title"
 CausesValidation="True"
 ClientEvents-OnBlur="ValidateTitle">
</telerik:RadTextBox>
Robert
Top achievements
Rank 1
 answered on 29 Dec 2009
1 answer
202 views
Hi,
I have a grid with edit form (user control) for editing an item. I am insterested in disabling the entire grid in such a way that the user can still open the edit form and view the information without changing it. This needs to be done through code.
Is it possible?
Thanks,
Lynda
Daniel
Telerik team
 answered on 29 Dec 2009
3 answers
189 views
I have a RadGrid with two-level hierarchy for which the structure is defined programmatically. The datasource for the detail table is empty on page load. My idea was to query the database whenever an 'expand' event is fired and add the results to the datasource (which is held in viewstate). The event fires and the data is added to the datasource, but the Rebind() method throws the following exception:

Syntax error: Missing operand before 'Is' operator.

I tested the grid by loading some data on page load, so I know the NeedDataSource and DetailTableDataBind methods are working correctly. Some insight to why this is occurring would be appreciated. Sample code is provided below.

    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack) 
        { 
            this.loadGrid(); 
        } 
    } 
 
protected void loadGrid() 
    { 
        // Get the null level codes and sort according to display order 
        dataset = controller.GetCode(null); 
         
        // Set the keys 
        RadGrid1.MasterTableView.DataKeyNames = new string[] { "code", "value" }; 
        RadGrid1.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client; 
        RadGrid1.ClientSettings.EnablePostBackOnRowClick = true; 
 
        //Column to use to create the RadGrid columns 
        GridBoundColumn boundColumn; 
 
        //code column 
        boundColumn = new GridBoundColumn(); 
        RadGrid1.MasterTableView.Columns.Add(boundColumn); 
        boundColumn.DataField = "code"; 
        boundColumn.HeaderText = "Code"; 
        boundColumn.HeaderStyle.Width = 80; 
 
        //value column 
        boundColumn = new GridBoundColumn(); 
        RadGrid1.MasterTableView.Columns.Add(boundColumn); 
        boundColumn.DataField = "value"; 
        boundColumn.HeaderText = "Value"; 
        boundColumn.HeaderStyle.Width = 80; 
 
        // Create dataset for sub level codes 
        subDataset = new DataSet(); 
        GridTableView subGrid = new GridTableView(RadGrid1); 
        subTypeCodeGrid.Name = "SubCodes"; 
        subTypeCodeGrid.DataKeyNames = new string[] { "code", "value" }; 
        subTypeCodeGrid.AutoGenerateColumns = false; 
        GridRelationFields relationFields = new GridRelationFields(); 
        relationFields.MasterKeyField = "value"; 
        relationFields.DetailKeyField = "code"; 
        subTypeCodeGrid.ParentTableRelation.Add(relationFields); 
        RadGrid1.MasterTableView.DetailTables.Add(subGrid); 
         
        // Add columns to sub dataset 
        //code column 
        boundColumn = new GridBoundColumn();         
        subTypeCodeGrid.Columns.Add(boundColumn); 
        boundColumn.DataField = "code"; 
        boundColumn.HeaderText = "Code"; 
        boundColumn.HeaderStyle.Width = 80;         
 
        int gridWidth = 0; 
        for (int i = 0; i < RadGrid1.MasterTableView.Columns.Count; i++) 
        { 
            gridWidth += (int)RadGrid1.MasterTableView.Columns[i].HeaderStyle.Width.Value; 
        } 
        RadGrid1.Width = gridWidth + 30; 
    }     
 
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    { 
        int index = e.Item.ItemIndex; 
        if ((e.CommandName == RadGrid.ExpandCollapseCommandName || e.CommandName == "RowClick")) 
        { 
            string Value = RadGrid1.MasterTableView.Items[index]["value"].Text.ToString().Trim(); 
            if (loadedValues.Contains(Value)) 
            { 
                return; 
            } 
            else 
            { 
                loadedValues.Add(Value); 
                DataSet tempSubCodes = controller.GetCode(Value); 
                foreach (DataSet.table1Row row in tempSubCodes.table1) 
                { 
                    subDataset.table1.Rows.Add(row.ItemArray); 
                } 
                RadGrid1.Rebind(); //<-- ERROR 
            } 
            RadGrid1.MasterTableView.Items[index].Expanded = true; 
        } 
    } 
 
protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    { 
        if (!e.IsFromDetailTable) 
        { 
            RadGrid1.DataSource = dataset.table1.DefaultView; 
        } 
    } 
 
    protected void RadGrid1_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e) 
    { 
        switch (e.DetailTableView.Name) 
        { 
            case "SubCodes": 
                { 
                    e.DetailTableView.DataSource = subDataset.table1.DefaultView; 
                    break; 
                } 
        } 
    } 

Also, when the 'expand' button is clicked, the 'RowClick' ItemCommand is fired instead of the desired ExpandCollapseCommandName. Any way to change this?
Josh
Top achievements
Rank 1
 answered on 29 Dec 2009
7 answers
253 views
What is the simplist way to determine whether the checkbox for a node has changed its state. Currently I use Javascript code to store changes in a variable and send the contents of that variable back to the server. I suppose what I am looking for is something like a "CheckboxChanged" property. It really shouldn't have to be necessary for me to write additional code to keep track of these changes. It should be built into the Treeview control. In typical scenarios, when a user checks or unchecks something, this will often result in having to add or delete something on the server. Without recording the state, I would have to first get what already exists on the server and compare it to the current treeview state and either add or remove stuff.
Dimitar Milushev
Telerik team
 answered on 29 Dec 2009
4 answers
204 views
Hi,

I tried to implement checkbox into appointment template. There are few problems: the checkbox does not show when the text property is left empty, the box is deshape as it is unticked and there not trigger event option to select from.  Can I deploy web controls into appointment template as Radgrid, RCB etc?

Regards,

Duy
Kamen Bundev
Telerik team
 answered on 29 Dec 2009
1 answer
147 views
Hello,
I'm using RadGrid 2009.3 with LLBLGenProDataSource2 data source control and the following settings:

grid.MasterTableView.EditMode =

GridEditMode.EditForms;

 

grid.MasterTableView.EditFormSettings.EditFormType =

GridEditFormType.AutoGenerated;

Whenever user attempts to Update a record that results in the exception, I handle the exception through ItemUpdated event:

 

 

 

    private static void grid_ItemUpdated(object source, GridUpdatedEventArgs e)  
    {  
        if (e.Exception != null)  
        {  
            HandleInsertUpdateException((source as RadGrid), e, false);  
 
            e.ExceptionHandled = true;  
            e.KeepInEditMode = true;              
        }  
    } 


where HandleInsertUpdateException is my function for printing the error message.

The problem I'm faced with is this: whenever the user hits the Cancel link, the updated (incorrect) value still gets displayed in the grid.

What is the proper way to refresh the grid to have it display the original value whenever Update fails?

 

Veli
Telerik team
 answered on 29 Dec 2009
1 answer
124 views
good day ervery one,

when i try to upload file using uploader inside radajaxpanel it stop working
؛مثشسث اثمح ةث
Genady Sergeev
Telerik team
 answered on 29 Dec 2009
10 answers
169 views
Hi,

I am using a grid with a popup ( to edit/delete/add new records )
editformtype = autogenerated

Is it possible to change the length of the fields in the popup window ???
and how ?
a screendump is attached ?

Br
Pettsen
Princy
Top achievements
Rank 2
 answered on 29 Dec 2009
1 answer
114 views

This is the definition we have in .aspx

 

 

<telerik:RadCalendar ID="RadCalendar2" runat="server" Font-Names="Arial,Verdana,Tahoma"

 

 

 

ForeColor="Black" Skin="Outlook" Style="border-color: #ececec"

 

 

 

EnableViewSelector="True" AutoPostBack="false">

 

 

 

</telerik:RadCalendar>

 

 

 

A function with the following lines is called on pageload:

 

RadCalendar2.SpecialDays.Clear();

RadCalendar2.SelectedDates.Clear();

 

 

RadCalendarDay NewDay = new RadCalendarDay(RadCalendar2);

 

 

 

foreach (DataRow drrow in dtALLDates.Rows)

 

{

NewDay =

new RadCalendarDay(RadCalendar2);

 

NewDay.Date =

Convert.ToDateTime(drrow["CalendarDate"]);

 

NewDay.ToolTip =

Convert.ToInt32(drrow["SeatsAvailable"]) > 0 ? Convert.ToInt32(drrow["SeatsAvailable"]) > 1 ? drrow["SeatsAvailable"] + " seats are available" : "1 seat is available"

 

 

 

 

:

Convert.ToInt32(drrow["InSchedule"]) == 0 ? "Session not offered or it is a holiday." : "Seats are not available.";

 

 

Boolean bselect = Convert.ToInt32(drrow["SeatsAvailable"]) > 0 && Convert.ToBoolean(drrow["AllowEdit"]) == true ? true : false;

 

NewDay.IsSelectable = bselect;

 

if (Convert.ToBoolean(drrow["IsOpted"]) == true)

 

{

NewDay.IsSelected =

true;

 

RadCalendar2.SelectedDates.Add(

new RadDate(Convert.ToDateTime(drrow["CalendarDate"].ToString())));

 

}

RadCalendar2.SpecialDays.Add(NewDay);

}


When we navigate from one month to another month, the highlighted dates are cleared. I tried lot of things. But nothing working. Please help me to come out of this issue.

Thanks a lot in advance.

Siva

Radoslav
Telerik team
 answered on 29 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?