Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
647 views
I have successfully added a RequiredFieldValidator on my grid, whose EditMode="InPlace":

if ((e.Item is GridDataInsertItem) && e.Item.IsInEditMode)  
{  
    //  Insert is clicked  
    GridEditableItem editedItem = e.Item as GridEditableItem;  
 
    GridDataItem dataItem = (GridDataItem)e.Item;  
 
    GridEditManager editMan = editedItem.EditManager;  
 
    GridDropDownListColumnEditor editor = editMan.GetColumnEditor("Id"as GridDropDownListColumnEditor;  
 
    RadComboBox dropDownList1 = editedItem["Id"].Controls[0] as RadComboBox;  
 
    TableCell cell = (TableCell)editor.ContainerControl;  
    //Declare the validator    
    RequiredFieldValidator rfv = new RequiredFieldValidator();  
 
    rfv.ControlToValidate = dropDownList1.ID;  
    rfv.ID = "valId";  
    rfv.ErrorMessage = @"<img src='Images/cautionIcon.png' class='Validation' />";  
 
    //Add the validator to the cell    
    cell.Controls.Add(rfv);    
 
    editor.ComboBoxControl.Skin = "MySkin";  
    editor.ComboBoxControl.EnableEmbeddedSkins = false;  
    editor.ComboBoxControl.DropDownWidth = Unit.Pixel(500);  
    editor.ComboBoxControl.Width = Unit.Pixel(380);  
 
    var erds = (from result in _s  
             where !_Ds.Any(dto =>  
                 dto.Id == result.SystemID)  
             select result).ToList<DTO>();  
 
    editor.DataSource = s;  
 
    editor.DataBind();  
}  
else if ((e.Item is GridEditableItem) && e.Item.IsInEditMode)  
{  
    //  Edit is clicked  
    GridEditableItem editedItem = e.Item as GridEditableItem;  
 
    GridDataItem dataItem = (GridDataItem)e.Item;  
 
    DTO affected = (DTO)e.Item.DataItem;  
 
    GridEditManager editMan = editedItem.EditManager;  
 
    GridDropDownListColumnEditor editor = editMan.GetColumnEditor("Id"as GridDropDownListColumnEditor;  
 
    RadComboBox dropDownList1 = editedItem["Id"].Controls[0] as RadComboBox;  
 
    TableCell cell = (TableCell)editor.ContainerControl;  
    //Declare the validator    
    RequiredFieldValidator rfv = new RequiredFieldValidator();  
 
    rfv.ControlToValidate = dropDownList1.ID;  
    rfv.ID = "Id";  
    rfv.ErrorMessage = @"<img src='Images/cautionIcon.png' class='Validation' />";  
 
    editor.ComboBoxControl.Skin = "EPSS";  
    editor.ComboBoxControl.EnableEmbeddedSkins = false;  
    editor.ComboBoxControl.DropDownWidth = Unit.Pixel(500);  
    editor.ComboBoxControl.Width = Unit.Pixel(380);  
 
    var erds = (from result in _s  
                where !_as.Any(dto =>  
                    dto.Id == result.SystemID && dto.Id != affected.Id)  
                select result).ToList<DTOSystem>();  
 
    editor.DataSource = s;  
 
    editor.DataBind();  
 
    editor.SelectedValue = affected.Id.ToString();  
 

I know my code is convaluted, but basically its correctly adding a RequiredFieldValidator when you click insert.  But not sure why, its now not putting an identical RequiredfieldValidator when I click 'Edit'?  I would think it would roughly be the same code.

J
Eyup
Telerik team
 answered on 20 Jun 2013
1 answer
58 views
Hi, 
   On a radgrid I would like to create two item command buttons that cause the insert form to create. I need to be able to distinguish between which one was clicked in the itemcreated event though. 

Can I somehow make the radgrid go into insert mode from the itemcommand event? The command names would be InsertChild & InsertAdult.

The reason for this is I want to load a different form into the insert depending on the button clicked. 
David
Top achievements
Rank 1
 answered on 20 Jun 2013
1 answer
54 views
Can someone help with a correct answer to This Thread...  The answer stated does not work..  The issue is that if someone continuously types in the editor the width will expand with the text and there is no setting to prevent this...  Any help would be appreciated. 
Ivaylo
Telerik team
 answered on 20 Jun 2013
6 answers
337 views
Hi all,

I've been experiencing width issues with the RadEditor. More exactly, when I type a continuous single line paragraph the width of the textbox dynamically grows accordingly to the line width.

Find attached screenshots showing the problem.

Thanks in advance.

Code

<telerik:RadEditor ID="txtBody" runat="server" EditModes="Design" Width="98%" Height="200px"
                    ContentAreaMode="Div" NewLineBr="true" ToolbarMode="Default" AutoResizeWidth="false"  >
                    <Tools>
                        <telerik:EditorToolGroup Tag="Edit">
                            <telerik:EditorTool Name="Undo" />
                            <telerik:EditorTool Name="Redo" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="Cut" />
                            <telerik:EditorTool Name="Copy" />
                            <telerik:EditorTool Name="Paste" ShortCut="CTRL+!" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="PasteFromWord" />
                            <telerik:EditorTool Name="PasteFromWordNoFontsNoSizes" />
                            <telerik:EditorTool Name="PastePlainText" />
                            <telerik:EditorTool Name="PasteAsHtml" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="Print" />
                            <telerik:EditorTool Name="SelectAll" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="InsertDate" />
                            <telerik:EditorTool Name="InsertTime" />
                        </telerik:EditorToolGroup>
                        <telerik:EditorToolGroup Tag="Font">
                            <telerik:EditorTool Name="Bold" />
                            <telerik:EditorTool Name="Italic" />
                            <telerik:EditorTool Name="Underline" />
                            <telerik:EditorTool Name="StrikeThrough" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="JustifyLeft" />
                            <telerik:EditorTool Name="JustifyCenter" />
                            <telerik:EditorTool Name="JustifyRight" />
                            <telerik:EditorTool Name="JustifyFull" />
                            <telerik:EditorTool Name="JustifyNone" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="Superscript" />
                            <telerik:EditorTool Name="Subscript" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="ConvertToLower" />
                            <telerik:EditorTool Name="ConvertToUpper" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="Indent" />
                            <telerik:EditorTool Name="Outdent" />
                            <telerik:EditorTool Name="InsertOrderedList" />
                            <telerik:EditorTool Name="InsertUnorderedList" />
                            <telerik:EditorTool Name="ToggleTableBorder" />
                        </telerik:EditorToolGroup>
                        <telerik:EditorToolGroup Tag="Color-Font">
                            <telerik:EditorTool Name="ForeColor" />
                            <telerik:EditorTool Name="BackColor" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Name="FontName" />
                            <telerik:EditorTool Name="FontSize" />
                        </telerik:EditorToolGroup>
                    </Tools>
                </telerik:RadEditor>


Library Specs
  • Telerik.Web.UI Version=2011.3.1305.35
Ivaylo
Telerik team
 answered on 20 Jun 2013
2 answers
595 views
Good morning everyone. I am trying to use a RadTimePicker to insert a time into a database column with data type of time(7). However, when I try to do this, I get the following error "String was not recognized as a valid TimeSpan." Any ideas?
ihsojsakiv
Top achievements
Rank 2
 answered on 20 Jun 2013
1 answer
87 views
Hi,

            I tried the update query to update the details in grid control with below code.But I got the error(Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
). when i click the update button.

 My Code:
              GridDataItem updateitem = (e.Item as GridDataItem);
            string id = updateitem.OwnerTableView.DataKeyValues[updateitem.ItemIndex]["userid"].ToString();//Error Comes in this line
            TextBox txtuname = (updateitem)["userid"].Controls[0] as TextBox;
            TextBox txtdob = (updateitem)["dateofjoin"].Controls[0] as TextBox;
            TextBox txtpwd = (updateitem)["pwd"].Controls[0] as TextBox;
            string unameupdate = txtuname.Text;
            string dobupdate = txtdob.Text;
            string pwdupdate = txtpwd.Text;
            conn.Open();
            string updateaccount = "update login set userid ='" + unameupdate + "',pwd ='" + pwdupdate + "',cpwd ='" + pwdupdate + "',dateofjoin ='" + dobupdate + "' where userid ='" + id + "'";
            cmd = new MySqlCommand(updateaccount, conn);
            cmd.ExecuteNonQuery();
            conn.Close();
            showaccountuser();
Princy
Top achievements
Rank 2
 answered on 20 Jun 2013
1 answer
77 views
Hi there,

I'm using RadGrid and its ExportToExcel feature. I tried both approach of using the built-in button by setting OnBiffExporting="ExportList" and :
<CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"
    ShowRefreshButton="true" />
 and create my own:
<telerik:RadButton ID="rbtIGTExportToExcel" Width="150px" Text="Export To Excel" OnClick="btnExcel_Click"
    runat="server" Icon-PrimaryIconUrl="~/images/icons/sys-excel.png" />

Both are calling similar methods:
  1. Built-in version:
protected void ExportList(object sender, EventArgs e)
{
    RadGridListAllUser.ExportSettings.IgnorePaging = true;
    RadGridListAllUser.ExportSettings.OpenInNewWindow = true;
    RadGridListAllUser.ExportSettings.FileName = string.Format("{0} User List Export {1}", (string)Session["StudyName"], DateTime.Now.ToShortDateString());
    RadGridListAllUser.MasterTableView.ExportToExcel();
}

2. Custom version:
protected void btnExcel_Click(object sender, EventArgs e)
{
    rgIGTSummaryGrid.ExportSettings.IgnorePaging = true;
    rgIGTSummaryGrid.ExportSettings.OpenInNewWindow = true;
    rgIGTSummaryGrid.ExportSettings.FileName = string.Format("{0} IGT Export {1}", (string)Session["StudyName"], DateTime.Now.ToShortDateString());
    rgIGTSummaryGrid.MasterTableView.ExportToExcel();
}


In both version the FileName property is set but only the custom version ends up with this name, the built-in one keeps spitting a  RadGridExport.xls. Plus, in the custom version, all forbidden characters such as : / & < > are automatically replaced by _ which doesn't happen with the built-in feature.

Is this a bug or am I doing something wrong ?

Cheers,
Princy
Top achievements
Rank 2
 answered on 20 Jun 2013
1 answer
71 views
Hi,

after upgrading to the Q2 2013, our itemtemplates in the grid gets bricked after doing an ajax call. The ajax call updates the grid. I have attached screenshots, which show the described behavior. The itemtemplate was running with the same implementation for the last year. 
Angel Petrov
Telerik team
 answered on 20 Jun 2013
3 answers
158 views
Hi guys ,,  am new with Telerik controls , and this is my first Thread on this Forum.

I have RadGrid control on my Webpart project (using Telerik for Web version 3.5) ,
 every thing is OK , I set the pager-Style mode to "Numeric" and the page size =20 .

the grid display by default 10 pages links like  (1,2,3,4,5,6,7,8,9,10) ,  and when click next It will get the next 10 page links.

I want to set the Grid to display more then 10 links at one time , like (1,2,3,4,5,6,7,8,9,,10,11,12.13,14,15) .
I googled for the property but unfortunately i did't get what i want .

Please Can any one guide me to the solution.
Thanks
Andrey
Telerik team
 answered on 20 Jun 2013
6 answers
786 views
Hello people.
i will like to know if thers's a way to make rows merge in the grid?

thanks in advance
Hector Hernandez
Top achievements
Rank 2
 answered on 20 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?