Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
298 views

I need to add a default value to one of the textboxes when adding a new item in the grid

<telerik:GridTemplateColumn HeaderText="Activity ID" SortExpression="activityID" UniqueName="activityID"  >

                    <ItemTemplate>

                        <%# Eval("activityID")%>

                    </ItemTemplate>

                    <EditItemTemplate>

                        <asp:TextBox runat="server" ID="txtActivity" Text='<%# Bind("activityID") %>' />

                        <asp:RequiredFieldValidator runat="server" ID="rfvActivity" ControlToValidate="txtActivity" Display="Dynamic" ErrorMessage="*" />

                    </EditItemTemplate>

                </telerik:GridTemplateColumn>

 

 

When clicking “Add new recored” I need to pre-populate the txtActivity textbox. How can I access this from the code behind?

 

I tried this with no success

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

        {

            if (e.CommandName == RadGrid.InitInsertCommandName)

            {

                GridEditableItem editedItem = e.Item as GridEditableItem;

                TextBox t = (TextBox)(editedItem.FindControl("txtActivity"));

            }

        }

 

And this:

 

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)

        {

            if (e.Item is GridCommandItem && e.Item.OwnerTableView.IsItemInserted)

            {               

                TextBox txtActivity = (TextBox)e.Item.FindControl("txtActivity");

                txtActivity.Text = "300";

            }

}

I am running out of ideas.

Please help. Thanks

Kati
Top achievements
Rank 1
 answered on 08 Oct 2012
1 answer
118 views
Hello,
I have following code:

<telerik:GridDateTimeColumn FilterControlWidth="140px" DataField="Datum" HeaderText="Datum"
    SortExpression="Datum" UniqueName="Datum" PickerType="DateTimePicker"
    EnableRangeFiltering="true" CurrentFilterFunction="Between" ReadOnly="True" AllowFiltering="True" FilterListOptions="VaryByDataType">
    <HeaderStyle Width="220px" />
</telerik:GridDateTimeColumn>

I would like to implement followin: After one of two dates will be picked second one should be set to the same value. How I can implement this behaviour with the simplest solution?


Angel Petrov
Telerik team
 answered on 08 Oct 2012
1 answer
93 views
Have a simple question -  the purpose of this is to reduce the data transferred during every page request. 
Is there any way that when there is a postback, I can SELECTIVELY bind the data belonging to THAT specific page on the RadGrid?

The issue is that in our application, we have a grid.  We show maybe only 20 rows per page. There maybe twenty such pages.  When any one particular row is edited, I am rebinding the grid with ALL the data that fills up ALL the pages. I wish there is some way that I could rebind only the data that the user is looking at on that specific page.

Thanks in adavance for your response.
Angel Petrov
Telerik team
 answered on 08 Oct 2012
1 answer
85 views
I created a new page with code from a grid from another page.  For some reason, when I expand the rows, the page performs a post back to the server.  I have the HierarchyLoadMode for the MasterTableView set to "Client".  This works on the other page just fine.  Any ideas?

<rad:RadGrid ID="GridSummary" runat="server" OnColumnCreated="Grid_ColumnCreated"
    OnItemCreated="Grid_ItemCreated" OnItemDataBound="Grid_ItemDataBound"
    EnableEmbeddedSkins="false" Skin="MetroMagenta" Width="900px" AutoGenerateColumns="false">
    <MasterTableView HierarchyDefaultExpanded="true" HierarchyLoadMode="Client"
        OnDataBound="Grid_DataBound"
        DataKeyNames="RecordId, ParentRecordId, RecordName"> 
        <SelfHierarchySettings ParentKeyName="ParentRecordId" KeyName="RecordId" />
        <Columns>
            <rad:GridBoundColumn DataField="RecordName" UniqueName="RecordName" HeaderText="" />
            <rad:GridBoundColumn DataField="SocialVolume" UniqueName="SocialVolume" HeaderText="Social Volume"  HeaderStyle-Width="150px" ItemStyle-Width="150px" />
            <rad:GridBoundColumn DataField="CaseVolume" UniqueName="CaseVolume" HeaderText="Case Volume"  HeaderStyle-Width="150px" ItemStyle-Width="150px" />
            <rad:GridBoundColumn DataField="HelpVolume" UniqueName="HelpVolume" HeaderText="Help Volume"  HeaderStyle-Width="150px" ItemStyle-Width="150px" />
        </Columns>
    </MasterTableView>
    <ClientSettings AllowExpandCollapse="true" />
</rad:RadGrid>
Angel Petrov
Telerik team
 answered on 08 Oct 2012
1 answer
94 views
Hi , i am using Q1 2011 version of rad control in the application

 

 

<telerik:RadGrid EnableEmbeddedSkins="false" CssClass="RadGrid_Outlook grid-inside-section"

 

 

 

ID="rdGridReport" runat="server" AutoGenerateColumns="False" PageSize="10"

 

 

 

AllowSorting="true" AllowPaging="true" Skin="Outlook">

 

 

 

<ClientSettings EnableRowHoverStyle="true">

 

 

 

<Selecting AllowRowSelect="true" />

 

 

 

</ClientSettings>

 

 

 

<MasterTableView DataKeyNames="ReportId" ClientDataKeyNames="ReportId" HeaderStyle-VerticalAlign="Top"

 

 

 

HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left">

 

 

 

<DetailTables>

 

 

 

<telerik:GridTableView DataKeyNames="ID" runat="server" Name="sample" Width="100%" PageSize="10">

 

 

 

<ParentTableRelation>

 

 

 

<telerik:GridRelationFields DetailKeyField="ReportId" MasterKeyField="ReportId" />

 

 

 

</ParentTableRelation>

 

 

 

<ExpandCollapseColumn Visible="True">

 

 

 

</ExpandCollapseColumn>

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn UniqueName="chkID" DataField="ID" HeaderStyle-Width="25px"

 

 

 

AllowFiltering="false" ItemStyle-HorizontalAlign="Left">

 

 

 

<HeaderTemplate>

 

 

 

<asp:CheckBox ID="cbAllCheckBox" runat="server" AutoPostBack="true" OnCheckedChanged="CheckAllCheckBoxes"

 

 

 

onclick="MakeDirty(this);" />

 

 

 

</HeaderTemplate>

 

 

 

<ItemTemplate>

 

 

 

<asp:CheckBox ID="chkOTCID" runat="server" Width="12px" onclick="checkboxClicked(event, this.id)" />

 

 

 

</ItemTemplate>

 

 

 

<HeaderStyle Width="25px" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderStyle-Width="50px"

 

 

 

ItemStyle-HorizontalAlign="Left">

 

 

 

<HeaderStyle Width="50px" />

 

 

 

</telerik:GridEditCommandColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="ID" DataField="ID" HeaderText="ID" Visible="false" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="pName" DataField="pName"

 

 

 

HeaderText="Project" HeaderStyle-Width="20%" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="File" DataField="PropertyNumber"

 

 

 

HeaderText="File" HeaderStyle-Width="20%" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="FileType" DataField="FileType"

 

 

 

HeaderText="File Type" HeaderStyle-Width="20%" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="DescriptionDate"

 

 

 

DataField="DescriptionDate" HeaderText="Description Date"

 

 

 

HeaderStyle-Width="10%" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="Status" DataField="Status"

 

 

 

HeaderText="Status" HeaderStyle-Width="15%" />

 

 

 

<telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete"

 

 

 

ConfirmDialogType="Classic" ConfirmTitle="Confirm Delete" ConfirmText="Are you sure you want to delete this record?"

 

 

 

ItemStyle-HorizontalAlign="Left">

 

 

 

<HeaderStyle Width="50px" />

 

 

 

</telerik:GridButtonColumn>

 

 

 

<telerik:GridTemplateColumn Visible="false">

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="lbStatus" runat="server" Text='<%#Bind("Status") %>'></asp:Label>

 

 

 

<asp:Label ID="lbPropertyActive" runat="server" Text='<%#Bind("Active") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

<EditFormSettings EditFormType="WebUserControl" UserControlName="~/Approvals.ascx">

 

 

 

<EditColumn UniqueName="EditCommandColumn1">

 

 

 

</EditColumn>

 

 

 

</EditFormSettings>

 

 

 

</telerik:GridTableView>

 

 

 

</DetailTables>

 

 

 

<ExpandCollapseColumn Visible="True">

 

 

 

</ExpandCollapseColumn>

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn DataField="ReportId" HeaderText="ReportId" UniqueName="ReportId"

 

 

 

Visible="false" />

 

 

 

<telerik:GridBoundColumn DataField="ReportName" HeaderText="Report Name" UniqueName="ReportName">

 

 

 

<HeaderStyle Width="200px" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn>

 

 

 

<ItemTemplate>

 

 

 

<asp:LinkButton ID="lbDownLoadReport" runat="server" Text="OTC Report" CommandName="Download"></asp:LinkButton>

 

 

 

</ItemTemplate>

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn UniqueName="UnSubmit">

 

 

 

<ItemTemplate>

 

 

 

<asp:LinkButton ID="lbUnSubmitReport" runat="server" Text="UnSubmit Report" ToolTip="UnSubmit Report"

 

 

 

CommandName="UnSubmit" OnClientClick="if( ! OTCReportcheck()) return false;"></asp:LinkButton>

 

 

 

</ItemTemplate>

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

<ItemStyle VerticalAlign="Top" Wrap="True" />

 

 

 

<HeaderStyle VerticalAlign="Top" />

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

-----------------------------------------------------------

Above is html of grid , poblem i am facing

 

 

I delete the last record using the Delete button in DetailTables (last column) ,telerik inbuilt javascript breaks .
Although it works fine when record reaches at top using sorting.

Following is error log:


ception of type 'System.Web.HttpUnhandledException' was thrown.   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.layouts_singlelayout_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously).

----------------------------
 Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index   at System.Collections.ArrayList.get_Item(Int32 index)
   at Telerik.Web.UI.GridTableView.SetDataSourceFilter()
   at Telerik.Web.UI.GridTableView.FilterDetailDataSource()
   at Telerik.Web.UI.GridTableView.DataBind()
   at Telerik.Web.UI.GridTableView.Rebind()
   at Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source)
   at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

 

 

Angel Petrov
Telerik team
 answered on 08 Oct 2012
1 answer
156 views
What is the syntax for using the RadGrid between filter?  I am using a DataTable as my datasource.  When I apply greater then it works, but the between filter isn't working.   I have tried

81000,82000
81000|82000
81000 and 82000

Thanks,
Tony
Angel Petrov
Telerik team
 answered on 08 Oct 2012
4 answers
832 views
Hello,

I am trying to write some Javascript that will traverse all the rows of a radgrid and determine how many rows have a checkbox that is checked. 

I have a GridTemplateColumn that contains a Checkbox in the radgrid.  This is the checkbox I am trying to determine (for each record) if it is checked or not.

How do I do this in Javascript?

I was able to do it on Server side, but I would prefer to do this in Java script.

Thanks!
Waseem
Top achievements
Rank 1
 answered on 08 Oct 2012
1 answer
68 views
Hi,
we use Telerik Controls library v 2008

is it possible to implement spell check for the Editor control v 2008 ?
if anybody knows how to do that, please share your knowledge

Thanks a lot.

Oleks
Rumen
Telerik team
 answered on 08 Oct 2012
1 answer
160 views
I have a custom developed SharePoint 2010 solution which uses a File Explorer in a page view control in order to view files on the system drive.  It seems to work great except for the fact that when i go to the site in IE9 an additional header seems to show on my site.  It works fine in Firefox, but not in IE.  I verified that when i remove the user control containing the file explorer, everything returns to normal.

I followed this blog post in order to get it to work.
http://www.telerik.com/support/kb/aspnet-ajax/fileexplorer/physical-paths-and-different-content-types.aspx

Screenshots attached.  Please advise if there is a way to fix this.
Thanks in advance!
Vessy
Telerik team
 answered on 08 Oct 2012
0 answers
77 views
done...
Felipe
Top achievements
Rank 1
 asked on 08 Oct 2012
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?