Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
150 views
Hi,

Please tell me how to achieve something like this:

RadGrid1.MasterTableView.AutoGeneratedColumns[

 

"somecol"].HeaderText = "My Column";

 


In this instance I only want to set the column header text but say i want to programmatically access a column for any reason I can't see a method to allow me to do this by key and it is impossible to know the index of the column
Al
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 29 Jun 2010
3 answers
113 views
I've built a RadGrid with a custom edit form.  I then use this form for both inserting and editing of records.  The insert portion works correctly but when I try to edit a record the form comes up without any values in the RadNumericTextBox.

I've tried populating the fields like the code below but then I get an error error when I switch to insert mode.
<telerik:RadNumericTextBox ID="txt_open_indemnity" Runat="server" Text='<%#  Bind( "paid_indemnity" ) %>'  
    CssClass="style2" Culture="English (United States)" DataType="System.Decimal"  
    TabIndex="8" Type="Currency" Value="0" Width="100px"> 
</telerik:RadNumericTextBox> 

How do I populate the text fields when the RadGrid is in edit mode?
Tsvetoslav
Telerik team
 answered on 29 Jun 2010
3 answers
137 views
Hi,

I'm having an issue with adding columns to the radgrid programmatically.  I'm adding GridTemplateColumns and doing it in Page_Init.  I have read the documentation and have realized that I need to add them to the ColumnCollection before I set the properties so I am doing this also.  Everything displays properly if(!Postback), but when I click to sort, refresh, page, etc, the content that I had displayed inside the grid remains, but a duplicate column is inserted for each column and the content in that column is blank.  I have tried moving and taking out adding the new columns in the Page_Load, OnPreRender, Page_Init, and with if(!Postback) in each case, but I am not having any luck. 

Is there something small that I'm missing that you can help me out with?

Thanks in advance,
Matt
mdanna
Top achievements
Rank 1
 answered on 29 Jun 2010
6 answers
224 views
I have a radgrid with an edit button, some columns and a image button that will pop up a modal radwindow from the code behind.

Aftter clicking the image button, the popup comes up with no issues and then close it. After cliciking the edit button, the edit form comes up fine, but the radwindow also pops up again and must manually close it. It pops up without me actually clicking on the image button to pop it up again. It's very annoying for the user since they have to close it each time when they simply just want to edit a record.

Here is my abbreviated html:
<code>

<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
           
        </Windows>
    </telerik:RadWindowManager>

<telerik:RadGrid ID="RadGrid1" runat="server" Skin="Outlook" AutoGenerateColumns="False" OnItemCommand="RadGrid1_ItemCommand"
                        OnNeedDataSource="RadGrid1_NeedDataSource" OnItemDataBound="RadGrid1_ItemDataBound"
                        OnInsertCommand="RadGrid1_InsertCommand" OnUpdateCommand="RadGrid1_UpdateCommand"
                        AllowPaging="True" AllowSorting="True" PageSize="20" GridLines="None">
                        <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="Provider_FacilityID"
                            EditMode="EditForms">
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../images/icon_edit.gif"
                                    UniqueName="EditCommandColumn">
                                    <HeaderStyle Width="20px" />
                                </telerik:GridEditCommandColumn>
                                <telerik:GridBoundColumn UniqueName="provider" HeaderText="Provider" DataField="provider">
                                </telerik:GridBoundColumn>
                               
                                <telerik:GridBoundColumn UniqueName="providerStatus" HeaderText="ProviderStatus"
                                    DataField="providerStatus" HtmlEncode="true">
                                </telerik:GridBoundColumn>
                                <telerik:GridDateTimeColumn DataField="ProviderFacilityStartDate" HeaderText="Start Date"
                                    DataFormatString="{0:MM/dd/yyyy}" UniqueName="ProviderFacilityStartDate" AutoPostBackOnFilter="true">
                                </telerik:GridDateTimeColumn>
                                <telerik:GridDateTimeColumn DataField="ProviderFacilityEndDate" HeaderText="End Date"
                                    DataFormatString="{0:MM/dd/yyyy}" UniqueName="ProviderFacilityEndDate" AutoPostBackOnFilter="true">
                                </telerik:GridDateTimeColumn>
                                <telerik:GridBoundColumn UniqueName="workStatus" HeaderText="Facility Rel Status"
                                    DataField="workStatus" HtmlEncode="true">
                                </telerik:GridBoundColumn>
                                <telerik:GridDateTimeColumn DataField="PrivilegesGrantedDate" HeaderText="Privileges Granted"
                                    DataFormatString="{0:MM/dd/yyyy}" UniqueName="PrivilegesGrantedDate" AutoPostBackOnFilter="true">
                                </telerik:GridDateTimeColumn>
                                <telerik:GridDateTimeColumn DataField="PrivilegesExpiration" HeaderText="Privileges Expiration"
                                    DataFormatString="{0:MM/dd/yyyy}" UniqueName="PrivilegesExpiration" AutoPostBackOnFilter="true">
                                </telerik:GridDateTimeColumn>
                                <telerik:GridBoundColumn UniqueName="PrivilegeStatus" HeaderText="Privilege Status"
                                    DataField="PrivilegeStatus" HtmlEncode="true">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn UniqueName="FacilityID" HeaderText="FacilityID" DataField="FacilityID"
                                    HtmlEncode="true" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn UniqueName="ProviderID" HeaderText="ProviderID" DataField="ProviderID"
                                    HtmlEncode="true" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn UniqueName="Provider_FacilityID" HeaderText="Provider_FacilityID"
                                    DataField="Provider_FacilityID" HtmlEncode="true" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn HeaderText="" UniqueName="changeSeq1">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="relation" runat="server" ImageUrl="~/images/folder-documents.png"
                                            OnClick="relationship_Click" ToolTip="Relationship" />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="" UniqueName="changeSeq2">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="EnrollForm" runat="server" ImageUrl="~/images/icon_document.gif"
                                            OnClick="enrollmentForm_Click" ToolTip="Enrollment Form" />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                            <EditFormSettings EditFormType="Template">
                                <EditColumn UniqueName="EditCommandColumn1">
                                </EditColumn>
                                <FormTemplate>
                                    <table id="Table2" border="0" cellpadding="1" cellspacing="2" rules="none" style="border-collapse: collapse;
                                        background: white;" width="100%">
                                        <tr valign="top">
                                            <td>
                                                <asp:Panel ID="Panel1" runat="server" GroupingText="Provider Facility Relationship">
                                                    <table id="Table3" border="0" cellpadding="1" cellspacing="1" width="100%">
                                                        <tr>
                                                            <td style="width: 186px" class="td_AEV">
                                                                Provider
                                                            </td>
                                                            <td class="td_AEVNoBold">
                                                                <asp:DropDownList ID="drpProvider" runat="server">
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <tr valign="top">
                                                            <td style="width: 186px" class="td_AEV">
                                                                Work Status
                                                            </td>
                                                            <td class="td_AEVNoBold">
                                                                <asp:DropDownList ID="WorkStatusID" runat="server" DataSourceID="LinqDataSource1"
                                                                    DataTextField="Description" DataValueField="WorkStatusID" AppendDataBoundItems="true"
                                                                    SelectedValue='<%# Bind("WorkStatusID") %>'>
                                                                    <asp:ListItem Text="" Selected="True" Value=""></asp:ListItem>
                                                                </asp:DropDownList>
                                                                <span style="color: Red">*</span>
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                                                                    ControlToValidate="WorkStatusID" ErrorMessage=" Required Field"></asp:RequiredFieldValidator>
                                                                <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="HPPInfoNet.Data.hppInfoNet2DataContext"
                                                                    Select="new (Description, WorkStatusID)" TableName="WorkStatus">
                                                                </asp:LinqDataSource>
                                                               
                                                            </td>
                                                        </tr>
                                                        <tr valign="top">
                                                            <td style="width: 186px" class="td_AEV">
                                                                Start Date
                                                            </td>
                                                            <td class="td_AEVNoBold">
                                                                <telerik:RadDatePicker ID="ProviderFacilityStartDate" runat="server" DataFormatString="{0:MM/dd/yyyy}">
                                                                </telerik:RadDatePicker>
                                                            </td>
                                                        </tr>
                                                        <tr valign="top">
                                                            <td style="width: 186px" class="td_AEV">
                                                                End Date
                                                            </td>
                                                            <td class="td_AEVNoBold">
                                                                <telerik:RadDatePicker ID="ProviderFacilityEndDate" runat="server" DataFormatString="{0:MM/dd/yyyy}">
                                                                </telerik:RadDatePicker>
                                                            </td>
                                                        </tr>
                                                        <tr valign="top">
                                                            <td style="width: 186px" class="td_AEV">
                                                                Relationship Status
                                                            </td>
                                                            <td class="td_AEVNoBold">
                                                                <asp:DropDownList ID="PhysicianStatusID" runat="server" DataSourceID="LinqDataSource2"
                                                                    DataTextField="Description" DataValueField="PhysicianStatusID" AppendDataBoundItems="true"
                                                                    SelectedValue='<%# Bind("PhysicianStatusID") %>'>
                                                                    <asp:ListItem Text="" Selected="True" Value=""></asp:ListItem>
                                                                </asp:DropDownList>
                                                                <span style="color: Red">*</span>
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                                                                    ControlToValidate="PhysicianStatusID" ErrorMessage=" Required Field"
                                                                    ></asp:RequiredFieldValidator>
                                                                <asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="HPPInfoNet.Data.hppInfoNet2DataContext"
                                                                    Select="new (Description, PhysicianStatusID)" TableName="PhysicianStatus">
                                                                </asp:LinqDataSource>
                                                               
                                                            </td>
                                                        </tr>
                                                        <tr valign="top">
                                                            <td style="width: 186px" class="td_AEV">
                                                                Privileges Granted Date
                                                            </td>
                                                            <td class="td_AEVNoBold">
                                                                <telerik:RadDatePicker ID="PrivilegesGrantedDate" runat="server" DataFormatString="{0:MM/dd/yyyy}">
                                                                </telerik:RadDatePicker>
                                                            </td>
                                                        </tr>
                                                        <tr valign="top">
                                                            <td style="width: 186px" class="td_AEV">
                                                                Privileges Expiration Date
                                                            </td>
                                                            <td class="td_AEVNoBold">
                                                                <telerik:RadDatePicker ID="PrivilegesExpiration" runat="server" DataFormatString="{0:MM/dd/yyyy}">
                                                                </telerik:RadDatePicker>
                                                            </td>
                                                        </tr>
                                                        <tr valign="top">
                                                            <td style="width: 186px" class="td_AEV">
                                                                Privileges Status
                                                            </td>
                                                            <td class="td_AEVNoBold">
                                                                <asp:DropDownList ID="PrivilegeStatusID" runat="server" DataSourceID="LinqDataSource3"
                                                                    DataTextField="Description" DataValueField="PrivilegeStatusID" AppendDataBoundItems="true"
                                                                    SelectedValue='<%# Bind("PrivilegeStatusID") %>'>
                                                                    <asp:ListItem Text="---" Selected="True" Value=""></asp:ListItem>
                                                                </asp:DropDownList>
                                                                <asp:LinqDataSource ID="LinqDataSource3" runat="server" ContextTypeName="HPPInfoNet.Data.hppInfoNet2DataContext"
                                                                    Select="new (Description, PrivilegeStatusID)" TableName="PrivilegeStatus">
                                                                </asp:LinqDataSource>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="width: 186px" class="td_AEV">
                                                                &nbsp;
                                                            </td>
                                                            <td align="left" class="td_AEVNoBold">
                                                                <asp:Button ID="Button3" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                                                </asp:Button>&nbsp;
                                                                <asp:Button ID="Button4" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                                                </asp:Button>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </asp:Panel>
                                            </td>
                                        </tr>
                                    </table>
                                </FormTemplate>
                            </EditFormSettings>
                        </MasterTableView>
                    </telerik:RadGrid>
</code>

Here is my code-behind:
<code>

protected void relationship_Click(object sender, ImageClickEventArgs e)
        {

            RadWindowManager1.Windows.Clear();

            RadWindow newwindow = new RadWindow();
            newwindow.ID = "RadWindow1";  //"RadWindow1";
            newwindow.Width = 1000;
            newwindow.Height = 600;
            newwindow.Modal = true;
            newwindow.VisibleOnPageLoad = true;
            newwindow.DestroyOnClose = true;
            newwindow.NavigateUrl = "../relationship/prvFacRelationship.aspx?usrname=" + ViewState["UserName"].ToString() + "&usremail=" + ViewState["UserEmail"].ToString() + "&pfID=" + pfID;
            RadWindowManager1.Windows.Add(newwindow);
        }


</code>

What can I do to make the popup stop popping up when I simply click on the edit button? If no solution, is there an update to the control set I need to use, etc. I am using version 2009.3.1314.35 of the controls.

Thanks,

Bill........
Georgi Tunev
Telerik team
 answered on 29 Jun 2010
5 answers
119 views
If I use the RadInputManager Validation for a given text box, and set it to required, after post back, the "EmptyMessage" behavior fails to work, and that text becomes the actual text that displays.

To recreate this situation outside of my application, I took the "Ajax" validation sample (http://demos.telerik.com/aspnet-ajax/ajax/examples/common/validation/defaultcs.aspx) and added a RadInputManager too it directly after the closing of the table:
          <telerik:RadInputManager ID="RadInputManager1" runat="server">
                <telerik:TextBoxSetting EmptyMessage="Enter Name"  InitializeOnClient="true"
                ErrorMessage="Name Required"
                Validation-IsRequired="true"
                Validation-ValidateOnEvent="All" >
                    <TargetControls>
                        <telerik:TargetInput ControlID="tbName" />
                    </TargetControls>
                </telerik:TextBoxSetting>
           </telerik:RadInputManager>
I then removed the "RequiredFieldValidator" named "RequiredFieldValidator1" to eliminate the redundant validation.

Upon submitting the form without entering any text entered in the text box, the error message is displayed in the text box as it should, but when you attempt to enter text in the text box, you find that the text box is filled with the "EmptyMessage" text, and the user must manually delete the text before entering the desired text.
Herve
Top achievements
Rank 2
 answered on 29 Jun 2010
1 answer
242 views
Hi 

i am using Rad grid , which contains Add,Edit, Delete image controls.  
if i am editing the first row and press enter key ,update method is called, if i edit other than first row the delete method is called. 
What should i do to prohibit this.

In the edit mode , if i press enter key it should call update method only, please let me know how can i achieve this..

Thanks!

Sebastian
Telerik team
 answered on 29 Jun 2010
3 answers
175 views
Hi,

I'm having a problem in autosize "true" in IE8. window appears scroll bar.
This error only happens with IE8 anyone have any solutions?

thks,
Bruno.

<telerik:RadWindow ID="Win_Central" runat="server"                                
                                Modal="true"
                                Behaviors="Close"
                                InitialBehaviors="Close"                                                                                                                                
                                ReloadOnShow="true"                                
                                OnClientBeforeClose="OnClientBeforeClose"
                                OnClientClose="OnClientClose"
                                OnClientActivate="OnClientActivate"
                                AutoSize="true">
</telerik:RadWindow>
Bruno Roberto
Top achievements
Rank 1
 answered on 29 Jun 2010
1 answer
174 views
There is an automatic feature on RadGrid (and on the default ASP.NET GridView) control for paging the rows in grid. If the datasource is an ObjectDataSource and we set the Select, Insert, Update, Delete, SelectCount methods, and set the EnablePaging="true", and the StartRowIndexParameterName, MaximumRowsParameterName properties also filled with the name of parameters of the ObjectDataSource overloaded method for paging, then the RadComboBox does not set value for the startRow and the pageSize parameter. As a side-effect the RadComboBox does not call the SelectCount method too.
 Here is an example:
 
 The ObjectDataSource declaration:
<asp:ObjectDataSource ID="dsEmplTable" runat="server" DataObjectTypeName="TableObjects.EmplTable" 
        TypeName="TableObjects.EmplTableAdapter" DeleteMethod="DeleteEmplTable" 
        InsertMethod="InsertEmplTable" SelectMethod="SelectEmplTable" UpdateMethod="UpdateEmplTable" 
        OldValuesParameterFormatString="original_{0}" EnableCaching="true" CacheDuration="10" 
        SortParameterName="sortExpression" SelectCountMethod="SelectCount" 
        EnablePaging="true" StartRowIndexParameterName="startRow" MaximumRowsParameterName="pageSize" 
        > 

 The select methods of the TableAdapter class:
 [DataObjectMethod(DataObjectMethodType.Select, true)]  
public EmplTableList SelectEmplTable(string sortExpression, int startRow, int pageSize)  
{  
    //If we use RadComboBox then the values of the startRow and the pageSize variables are 0  
    //If we use RadGrid then these parameters filled properly by default 
 
    //Here we want select only a range of employees from a tons of employee 
    DataAccessLayer.GetEmployees(emplTableCollection, startRow, pageSize); 
 
    SelectCount = emplTableCollection.Count; 
 
    _empltableData = empltableCollection;   
    return _empltableData;  
}  
  • SelectCount is a property on Adapter and its value is strored in Session variable for performance issue

 The select count method of the Adapter class:
public int SelectCountEmplTable() 
{ 
    return SelectCount; 
} 

 The RadComboBox that is using the declared ObjectDaraSource below:
<telerik:RadComboBox runat="server" ID="RadComboBox2" DataTextField="EmplId" 
               DataValueField="EmplId" HighlightTemplatedItems="true" Height="190px" Width="220px" 
               DropDownWidth="420px" DataSourceID="dsEmplTable" EnableVirtualScrolling="true" 
               EnableAutomaticLoadOnDemand="True" ItemsPerRequest="10" ShowMoreResultsBox="true"  
               OnItemsRequested="RadComboBox2_ItemRequested" 
               OnItemDataBound="RadComboBox2_ItemDataBound" 
               OnSelectedIndexChanged="RadComboBox2_SelectedIndexChanged" 
               OnDataBinding="RadComboBox2_DataBinding" 
               > 
               <HeaderTemplate> 
                   <ul> 
                       <li class="col1">Employee Id</li> 
                   </ul> 
               </HeaderTemplate> 
               <ItemTemplate> 
                   <ul> 
                       <li class="col1"><%# DataBinder.Eval(Container.DataItem, "EmplId") %></li> 
                   </ul> 
               </ItemTemplate> 
</telerik:RadComboBox> 

 My workaround: I've created some Session variable to retrieve the required variables (startRow, pageSize) at ObjectDataSource.Selecting event and set when the ItemRequested.
        protected void Page_Load(object sender, EventArgs e) 
        { 
            this.dsEmplTable.Selecting += new ObjectDataSourceSelectingEventHandler(dsEmplTable_Selecting); 
 
            if (Session["RADCOMBOBOX2_STARTROW"] == null) 
            { 
                Session.Add("RADCOMBOBOX2_STARTROW", 1); 
            } 
        } 
 
        void dsEmplTable_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) 
        { 
            e.Arguments.StartRowIndex = (int)Session["RADCOMBOBOX2_STARTROW"]; 
            e.Arguments.MaximumRows = (int)Session["RADCOMBOBOX2_MAXIMUMROWS"]; 
        } 

 The questions:
 Why RadComboBox does not support a similiar paging behavior as RadGrid supports?

 Will the new beta support this automatically as RadGrid supports it?

 Maybe I can't understand well the possibilities with RadComboBox and everything works fine if the datasource is ObjectDataSource. I don't want to preclude my mistake. :) So if there is a support for ObjectDataSource paging then how should I use RadComboBox with ObjectDataSource?


Kalina
Telerik team
 answered on 29 Jun 2010
1 answer
58 views
Are any changes planned for RAD Chart in Q2 2010 release?
Giuseppe
Telerik team
 answered on 29 Jun 2010
1 answer
110 views
Hi,

I have been using my grid in EditMode = Popup, it has been working fine but now the edit form stays visible after clicking 'Update' (I am sure it was closing automatically before). I have removed all code in the 'UpdateCommand' event just to be safe but still it does not disappear, any ideas as to what I can check?
Princy
Top achievements
Rank 2
 answered on 29 Jun 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?