Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
321 views
I have a radgrid and I have enabled edit/insert/update. The Grid does a great job of auto generating the fields and column sizes to fix the context of the data. How do I change the Edit/Insert "Popup" for the fields that need to be larger and with scrollbars? Below is my code that builds the RadGrid - how do I get to the setup I am wanting. I want to make the Issue/Notes/CorrectiveAction fields larger and almost like a memo field. Also how do you change to position of the field in the edit popup by making the window larger and placing the fields in different location..

My Radgrid Code as it is now.


<telerik:RadGrid ID="RadGrid2" runat="server" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataSourceID="OpenAccessLinqDataSource1" Skin="Sunset" CellSpacing="-1" GridLines="Both" AutoGenerateEditColumn="True">
<ExportSettings ExportOnlyData="True" FileName="SystemCabCommExport">
<Excel Format="ExcelML" />
</ExportSettings>
<MasterTableView AutoGenerateColumns="False" editmode="PopUp" CommandItemDisplay="Top" DataKeyNames="ItemNum" DataSourceID="OpenAccessLinqDataSource1">
<Columns>
<telerik:GridBoundColumn DataField="ItemNum" DataType="System.Int32" FilterControlAltText="Filter ItemNum column" HeaderText="ItemNum" ReadOnly="True" SortExpression="ItemNum" UniqueName="ItemNum">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="_Date" DataType="System.DateTime" FilterControlAltText="Filter _Date column" HeaderText="_Date" SortExpression="_Date" UniqueName="_Date">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="IssueType" FilterControlAltText="Filter IssueType column" HeaderText="IssueType" SortExpression="IssueType" UniqueName="IssueType">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Issue" FilterControlAltText="Filter Issue column" HeaderText="Issue" SortExpression="Issue" UniqueName="Issue">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ReportedBy" FilterControlAltText="Filter ReportedBy column" HeaderText="ReportedBy" SortExpression="ReportedBy" UniqueName="ReportedBy">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ResponsiblePerson" FilterControlAltText="Filter ResponsiblePerson column" HeaderText="ResponsiblePerson" SortExpression="ResponsiblePerson" UniqueName="ResponsiblePerson">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Notes" FilterControlAltText="Filter Notes column" HeaderText="Notes" SortExpression="Notes" UniqueName="Notes">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CorrectiveAction" FilterControlAltText="Filter CorrectiveAction column" HeaderText="CorrectiveAction" SortExpression="CorrectiveAction" UniqueName="CorrectiveAction">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Status" FilterControlAltText="Filter Status column" HeaderText="Status" SortExpression="Status" UniqueName="Status">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ClosedDate" DataType="System.DateTime" FilterControlAltText="Filter ClosedDate column" HeaderText="ClosedDate" SortExpression="ClosedDate" UniqueName="ClosedDate">
<ColumnValidationSettings>
<ModelErrorMessage Text="" />
</ColumnValidationSettings>
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Shinu
Top achievements
Rank 2
 answered on 16 Apr 2014
1 answer
234 views
When  i change the value in a field into rad grid (<BatchEditingSettings EditType="Row" OpenEditingEvent="Click" />),  i need to click somewhere in page, for appear the red triangle in left corner of the box. Which client side events call this? 
I want to call this event in my custom function?  
var grid = $find('<%=theLineItemsGrid.ClientID%>')
grid.??????
Eyup
Telerik team
 answered on 16 Apr 2014
4 answers
218 views
Hi,
I have the following challenge and I do not know how to solve this.
When the user enter the date in a dateTime column "Date" in edit mode, I need the week number to be automatically inserted in a bound column and saved to the db.
The week number is calculated in a method from code behind:

private static int WeekOfYear(DateTime date)
    {
        var day = (int)CultureInfo.CurrentCulture.Calendar.GetDayOfWeek(date);
        return CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date.AddDays(4 - (day == 0 ? 7 : day)), CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
    }

This is my actual grid:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" Culture="it-IT" DataSourceID="SqlDataSource1" PageSize="20" CellSpacing="-1" GridLines="Both">
                        <ExportSettings>
                            <Pdf PageHeight="297mm" PageWidth="" PaperSize="A4">
                            </Pdf>
                        </ExportSettings>
                        <ClientSettings>
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                        </ClientSettings>
                        <MasterTableView CommandItemDisplay="Top" DataKeyNames="Id" DataSourceID="SqlDataSource1" Caption="Working Hours" >
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton">
                                    <HeaderStyle Width="25px" />
                                </telerik:GridEditCommandColumn>
                                <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" FilterControlAltText="Filter Id column" HeaderText="Id" ReadOnly="True" SortExpression="Id" UniqueName="Id">
                                    <ColumnValidationSettings>
                                        <ModelErrorMessage Text="" />
                                    </ColumnValidationSettings>
                                    <HeaderStyle HorizontalAlign="Left" Width="35px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridDateTimeColumn DataField="Date" DataFormatString="{0:dd/MM/yyyy}" FilterControlAltText="Filter Date column" HeaderText="Date" SortExpression="Date" UniqueName="Date">
                                    <ColumnValidationSettings>
                                        <ModelErrorMessage Text="" />
                                    </ColumnValidationSettings>
                                    <HeaderStyle HorizontalAlign="Center" Width="85px" />
                                </telerik:GridDateTimeColumn>
 
                                <telerik:GridTemplateColumn DataField="Pnum" FilterControlAltText="Filter Pnum column" HeaderText="P Number" SortExpression="Pnum" UniqueName="Pnum">
                                    <EditItemTemplate>
                                        <telerik:RadComboBox ID="PnumRadComboBox" runat="server" DataSourceID="SqlDataSource2" DataTextField="Pnum" DataValueField="Pnum" SelectedValue='<%# Bind("Pnum") %>'>
                                        </telerik:RadComboBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="PnumLabel" runat="server" Text='<%# Eval("Pnum") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="65px" />
                                </telerik:GridTemplateColumn>
 
                                <telerik:GridDateTimeColumn DataField="WorkedTime" FilterControlAltText="Filter column column" PickerType="TimePicker" DataFormatString="{0:hh\:mm}" HeaderText="Worked Time" SortExpression="WorkedTime" UniqueName="column">
                                    <ColumnValidationSettings>
                                        <ModelErrorMessage Text="" />
                                    </ColumnValidationSettings>
                                    <HeaderStyle HorizontalAlign="Center" Width="65px" />
                                </telerik:GridDateTimeColumn>
 
                                <telerik:GridBoundColumn DataField="Note" FilterControlAltText="Filter Note column" HeaderText="Note" SortExpression="Note" UniqueName="Note">
                                    <ColumnValidationSettings>
                                        <ModelErrorMessage Text="" />
                                    </ColumnValidationSettings>
                                    <HeaderStyle HorizontalAlign="Center" />
                                </telerik:GridBoundColumn>
                                <telerik:GridClientDeleteColumn ButtonType="ImageButton" FilterControlAltText="Filter column1 column" UniqueName="column1">
                                    <HeaderStyle Width="25px" />
                                </telerik:GridClientDeleteColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
I would appreciate your help to solve this.
Thanks you,
Felice
Konstantin Dikov
Telerik team
 answered on 16 Apr 2014
2 answers
223 views
I am getting the following error on a form grid:

Exception type: IndexOutOfRangeException
Exception message: Cannot find table 0.
   at System.Data.DataTableCollection.get_Item(Int32 index)
   at storagePortal.shipout.RadGrid1_NeedDataSource(Object source, GridNeedDataSourceEventArgs e)
   at Telerik.Web.UI.RadGrid.OnNeedDataSource(GridNeedDataSourceEventArgs e)
   at Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason)
   at Telerik.Web.UI.RadGrid.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The web page was working fine yesterday.  Nothing changed that I know of, but this error is appearing today. The data source is provided by a stored procedure that I ran separately - it works fine.  Anyone have any ideas? 


Jayesh Goyani
Top achievements
Rank 2
 answered on 16 Apr 2014
1 answer
123 views
I have 3 dropDownList in my grid, all bind to Sql tables with SqlDatasource. The first one "Pnum" acts like I need, i.e. when a value is selected it stays there even when I re-open the record for modification. The other two "minutes" and "hours" behave in a different way, I mean every time I open the record for modification, the selected value is set to the first one in the db or nothing.

This is the good one:

<EditFormSettings EditFormType="Template">
<FormTemplate>
<table class="table">
.........
<telerik:RadDropDownList ID="RadDropDownList1" runat="server"
DataSourceID="SqlDataSource2" DataTextField="Pnum" DataValueField="Pnum"
SelectedValue='<%#Bind("Pnum") %>' Skin="Outlook" AutoPostBack="true">
</telerik:RadDropDownList>


These two give me the problem:

<telerik:RadDropDownList ID="RadDropDownList2" runat="server" DataSourceID="SqlDataSource3"
DataTextField="minutes" DataValueField="minutes" SelectedValue='<%#Bind("minutes") %>'
Skin="Outlook" AutoPostBack="true">
</telerik:RadDropDownList>
 
<telerik:RadDropDownList ID="RadDropDownList3" runat="server" DataSourceID="SqlDataSource4"
DataTextField="hours" AutoPostBack="false" DataValueField="hours"
SelectedValue='<%#Bind("hours") %>' Skin="Outlook">
</telerik:RadDropDownList>
.......
</table>
 </FormTemplate>
</EditFormSettings>


I do not see any difference that may cause such different behavior. Any hint on how to solve this problem? I mean, avoid that the value is changed when opening the record for modification.
Princy
Top achievements
Rank 2
 answered on 16 Apr 2014
20 answers
1.1K+ views
Hi all,

http://www.telerik.com/help/aspnet/grid/grddefaulteditmodeforgriditemsoninitialload.html


foreach(GridItem item in RadGrid1.MasterTableView.Items)
 {
  
if (item is GridEditableItem)
  {
   GridEditableItem editableItem= item
as GridDataItem;
   editableItem.Edit = true;
  }
 }
 RadGrid1.Rebind();


i am using the method in the above link to make my Radgrid editable on click of a button.
But.. this is not working... in fact when i click on another button t change it back to normal mode...it now appears in edit mode.!!!

can anyone help me?
Thanks in advance
John
Shinu
Top achievements
Rank 2
 answered on 16 Apr 2014
1 answer
152 views
Hi,
I have these two dropdownlists in a Edit Form Template where I tried to set the number of items to show and/or the height but is not producing any effect. please look at the pictures attached.

<EditFormSettings EditFormType="Template">
   <FormTemplate>
      <table class="table">
 
    <telerik:RadDropDownList ID="RadDropDownList2" ItemCountPerRequest="4"
     DefaultMessage="Please select a value" runat="server" DataSourceID="SqlDataSource3"
     DataTextField="minutes" DataValueField="minutes" SelectedValue='<%#Bind("minutes") %>' Skin="Outlook">
        </telerik:RadDropDownList>
 
    <telerik:RadDropDownList ID="RadDropDownList3" runat="server" ItemCountPerRequest="12"
     DataSourceID="SqlDataSource4" DataTextField="hours" DefaultMessage="Please select a value"
     DataValueField="hours" SelectedValue='<%#Bind("hours") %>' Skin="Outlook">
        </telerik:RadDropDownList>
 
      </table>
   </FormTemplate>
</EditFormSettings>
What I would like to achieve is the following:
For the dropdownlist "Minutes" shows only the 4 items
For the dropdownlist "hours" show the first 12" values and then the others only on demand.
How can I fix these dropdownlists to achieve the above scenario?
Thanks for the support,
Felice
Shinu
Top achievements
Rank 2
 answered on 16 Apr 2014
1 answer
289 views
Advanced data binding with NeedDataSource event works perfectly for me when I need paging, sorting, grouping and filtering.
Below is the code snippet from your documentation:

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    String ConnString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
    SqlConnection conn = new SqlConnection(ConnString);
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand("SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address FROM Customers", conn);
 
    DataTable myDataTable = new DataTable();
 
    conn.Open();
    try
    {
        adapter.Fill(myDataTable);
    }
    finally
    {
        conn.Close();
    }
 
    RadGrid1.DataSource = myDataTable;
}

The problem with that approach is that it needs to return all the data from database to let the grid make further data processing. What would you recommend to change in  the code snippet above if there is a million customer records in database and you need to implement paging, sorting and filtering and grouping on each field?
Princy
Top achievements
Rank 2
 answered on 16 Apr 2014
11 answers
829 views
Hi,
I was trying to use your CommandItemSettings to automatically display the Update and Delete buttons, like the AddNewRecordButton, but there is no such option available, I was wondering why? It would be useful to have those buttons available that would apply the command to the selected items in the grid, instead of having to add all to the CommandItemTemplate. These are common operations that one does in the grid...

Regards, Ariel
Princy
Top achievements
Rank 2
 answered on 16 Apr 2014
4 answers
179 views
I have a dropdownlist in template which is bound to a the db:

<telerik:RadDropDownList ID="RadDropDownList1" runat="server"  DataSourceID="SqlDataSource2"
          DataTextField="Pnum"  DataValueField="Pnum" SelectedValue='<%#Bind("Pnum") %>'>
         </telerik:RadDropDownList>

Then  I have a bound column "Project" that I would like to be automatically filled in when a value in the dropdown is selected based on a query:
Select Project from Pnum where Project = dropdown selected value, and save it.

How can I achieve that?
Your help will be appreciated.
Thanks,
Felice
Princy
Top achievements
Rank 2
 answered on 16 Apr 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?