Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
111 views
Hi all,

I am trying to achieve manual insert and update using form template. But it does not work. I am using linq-to-sql datasource. Datasource is set in NeedDataSource Event. Both InsertCommand and UpdateCommand events are not firing.

Code:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="dgv">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="dgv" />
                <telerik:AjaxUpdatedControl ControlID="lblStatus" />
                <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Silk" />
 
<div class="dbStatus">
    <asp:Label runat="server" ID="lblStatus" EnableViewState="false" Font-Bold="true" />
</div>
 
<telerik:RadGrid ID="dgv" runat="server" AutoGenerateColumns="False" PageSize="10" AllowPaging="True" AllowSorting="True"
    OnNeedDataSource="dgv_NeedDataSource" OnUpdateCommand="dgv_UpdateCommand" OnInsertCommand="dgv_InsertCommand"
    OnDeleteCommand="dgv_DeleteCommand" OnItemInserted="dgv_ItemInserted">
 
    <MasterTableView TableLayout="Auto" DataKeyNames="Record_Id" ShowHeadersWhenNoRecords="true" EditMode="PopUp">
 
        <NoRecordsTemplate>
            <div>
                There are no records
            </div>
        </NoRecordsTemplate>
 
        <Columns>
 
            <telerik:GridBoundColumn UniqueName="colRecordId" DataField="Record_Id" DataType="System.Int64" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,CountryId%>">
                <%--<HeaderStyle Width="120" />--%>
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn UniqueName="colContinent" DataField="Continent" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Continent%>">
                <%--<HeaderStyle Width="160" />--%>
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn UniqueName="colContinentBI" DataField="ContinentBI" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ContinentBI%>">
                <%--<HeaderStyle Width="160" />--%>
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn UniqueName="colDescription" DataField="Description" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Description%>">
                <%--<HeaderStyle Width="200" />--%>
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn UniqueName="colDescriptionBI" DataField="DescriptionBI" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionBI%>">
                <%--<HeaderStyle Width="200" />--%>
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn UniqueName="colCreatedBy" DataField="CreatedBy" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,CreatedBy%>">
                <%--<HeaderStyle Width="120" />--%>
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn UniqueName="colCreatedON" DataField="CreatedOn" DataType="System.DateTime" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,CreatedDate%>">
                <%--<HeaderStyle Width="160" />--%>
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn UniqueName="colModifiedBy" DataField="ModifiedBy" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ModifiedBy%>">
                <%--<HeaderStyle Width="120" />--%>
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn UniqueName="colModifiedOn" DataField="ModifiedOn" DataType="System.DateTime" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ModifiedDate%>">
                <%--<HeaderStyle Width="160" />--%>
            </telerik:GridBoundColumn>
 
        </Columns>
 
        <EditFormSettings EditFormType="Template" PopUpSettings-Modal="true">
            <FormTemplate>
 
                <table>
                    <tr>
                        <td colspan="3">
                            <br />
                            <asp:Label runat="server" ID="lblStatus" Font-Bold="true" />
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdLabel">
                            <asp:Label runat="server" ID="lblCountryId" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,CountryId%>"
                                AssociatedControlID="txtCountryId" />
                        </td>
                        <td class="tdControl">
                            <telerik:RadTextBox ID="txtCountryId" runat="server" Width="300" ReadOnly="true" Text='<%# Bind("Record_Id") %>' />
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="tdLabel">
                            <asp:Label runat="server" ID="lblContinent" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Continent%>"
                                AssociatedControlID="txtContinent" />
                        </td>
                        <td class="tdControl">
                            <telerik:RadTextBox ID="txtContinent" runat="server" Width="300" MaxLength="255" Text='<%# Bind("Continent") %>' />
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="tdLabel">
                            <asp:Label runat="server" ID="lblContinentBI" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ContinentBI%>"
                                AssociatedControlID="txtContinentBI" />
                        </td>
                        <td class="tdControl">
                            <telerik:RadTextBox ID="txtContinentBI" runat="server" Width="300" MaxLength="255" Text='<%# Bind("ContinentBI") %>' />
                        </td>
                        <td></td>
                    </tr>
 
                    <tr>
                        <td class="tdLabel">
                            <asp:Label runat="server" ID="lblDescription" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Description%>"
                                AssociatedControlID="txtDescription" />
                        </td>
                        <td class="tdControl">
                            <telerik:RadTextBox ID="txtDescription" runat="server" Width="300" MaxLength="255" ValidationGroup="CountryValidation" Wrap="false"
                                EmptyMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Description%>"
                                Text='<%# Bind("Description") %>' />
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="rfvDescription" runat="server" ValidationGroup="CountryValidation" ControlToValidate="txtDescription"
                                ErrorMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionRequiredValidationMessage%>" Text="*" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tdLabel">
                            <asp:Label runat="server" ID="Label1" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionBI%>"
                                AssociatedControlID="txtDescriptionBI" />
                        </td>
                        <td class="tdControl">
                            <telerik:RadTextBox ID="txtDescriptionBI" runat="server" Width="300" MaxLength="255" ValidationGroup="CountryValidation" Wrap="False"
                                EmptyMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionBI%>"
                                Text='<%# Bind("DescriptionBI") %>' />
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="rfvDescriptionBI" runat="server" ValidationGroup="CountryValidation" ControlToValidate="txtDescriptionBI"
                                ErrorMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionBIRequiredValidationMessage%>" Text="*" />
                        </td>
                    </tr>
                </table>
 
                <br />
                <br />
 
                <table>
                    <tr>
                        <td class="tdButton">
                            <telerik:RadButton ID="btnSubmit" runat="server" Width="100%" ValidationGroup="CountryValidation"
                                Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Submit%>"
                                CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />
                        </td>
                        <td class="tdButton">
                            <telerik:RadButton ID="btnCancel" runat="server" Width="100%"
                                Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Cancel%>"
                                CommandName="Delete" />
                        </td>
                    </tr>
                </table>
 
 
            </FormTemplate>
        </EditFormSettings>
 
    </MasterTableView>
</telerik:RadGrid>
 
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" />

CountryMasterBPO cm = new CountryMasterBPO();
 
protected void dgv_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    this.dgv.DataSource = cm.GetAllCountries();
}
 
 
protected void dgv_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
 
    RadAjaxManager1.ResponseScripts.Add(string.Format("Insert Command"));
 
    var editableItem = ((GridEditableItem)e.Item);
    var newCountry = new tbCountry_Master();
 
    Hashtable values = new Hashtable();
    e.Item.OwnerTableView.ExtractValuesFromItem(values, editableItem);
 
    newCountry.Continent = (string)values["Continent"];
    newCountry.ContinentBI = (string)values["ContinentBI"];
    newCountry.Description = (string)values["Description"];
    newCountry.DescriptionBI = (string)values["DescriptionBI"];
 
    newCountry.Exp1 = "0";
    newCountry.Exp2 = "0";
    newCountry.CreatedBy = SPContext.Current.Web.CurrentUser.LoginName;
    newCountry.CreatedOn = DateTime.Now;
    newCountry.ModifiedBy = SPContext.Current.Web.CurrentUser.LoginName;
    newCountry.ModifiedOn = DateTime.Now;
 
    var result = cm.SaveCountry(newCountry);
 
    DisplayMessage(!result, result ? "Sucessfully Saved" : "Error!!! Try Again");
 
}
 
 
protected void dgv_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
 
    RadAjaxManager1.ResponseScripts.Add(string.Format("Update Command"));
 
    var editableItem = ((GridEditableItem)e.Item);
    var recordId = (long)editableItem.GetDataKeyValue("Record_Id");
 
    RadAjaxManager1.ResponseScripts.Add(string.Format("Record Id: {0}", recordId));
 
    var country = cm.GetCountry(recordId);
    if (country != null)
    {
 
        RadAjaxManager1.ResponseScripts.Add(string.Format("Description: {0}", country.Description));
 
        editableItem.UpdateValues(country);
 
        country.ModifiedBy = SPContext.Current.Web.CurrentUser.LoginName;
        country.ModifiedOn = DateTime.Now;
 
        var result = cm.SaveCountry(country);
 
        DisplayMessage(!result, result ? "Sucessfully Updated" : "Error!!! Try Again");
 
    }
 
}
 
 
protected void dgv_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
 
    RadAjaxManager1.ResponseScripts.Add(string.Format("Delete Command"));
 
    var editableItem = ((GridEditableItem)e.Item);
    var recordId = (long)editableItem.GetDataKeyValue("Record_Id");
 
    bool isReferenced = false;
    var result = cm.DeleteCountry(recordId, out  isReferenced);
 
    DisplayMessage(!result, result ? "Sucessfully Deleted" : "Error!!! Try Again");
 
}
 
 
protected void dgv_ItemInserted(object sender, GridInsertedEventArgs e)
{
    if (e.Exception != null)
    {
        e.ExceptionHandled = true;
        e.KeepInInsertMode = true;
 
        DisplayMessage(true, e.Exception.Message.ToString());
 
    }
}
 
 
private void DisplayMessage(bool isError, string text)
{
    this.lblStatus.ForeColor = (isError) ? Color.Red : Color.Green;
    this.lblStatus.Text = text;
}

PS: This is sharepoint 2010 visual web part.
Konstantin Dikov
Telerik team
 answered on 22 Aug 2013
2 answers
160 views
I am unsure if this is an issue with the RadWindow or RadMenu.
This used to work but since upgrading the current release 2013.2.717.40 I have found that when a modal RadWindow is open you are still able to access and use RadMenus on the page. It appears to be a z-index problem.

Please refer to your own demo site
http://demos.telerik.com/aspnet-ajax/window/examples/modalpopup/defaultcs.aspx

In IE10 (I haven't tested other browsers) whilst the popup is modal you can still access the product families menu at the top of the page. I have a similar issue in my application but this is easier than providing code.

I imagine that I can come up with a workaround by hacking the css but was wondering if you had an official fix that will be released soon.

Thanks
Matt
Matthew Botting
Top achievements
Rank 1
 answered on 21 Aug 2013
2 answers
524 views
I have a collection of objects that I want to bind to a RadGrid.  Each object has a "AppName" property, as well as a collection of "Flag" objects.  The Flag object has a "FlagName" property.  So a simplified example of the object model would look like this:
public class Application
{
    public string AppName { get; set; }
    public List<Flag> Flags { get; set; }
}
public class Flag
{
    public string FlagName { get; set; }
    public bool IsAssigned { get; set; }
}

A sample object might look like this:
List<Application> apps = new List<Application> {
    new Application { AppName = "Search App",
        Flags = new List<Flag> {
            new Flag { FlagName = "Editor", IsAssigned = true },
            new Flag { FlagName = "User", IsAssigned = false },
            new Flag { FlagName = "Search", IsAssigned = true },
        }
    },
    new Application { AppName = "Probe",
        Flags = new List<Flag> {
            new Flag { FlagName = "Master", IsAssigned = false },
            new Flag { FlagName = "User", IsAssigned = true },
            new Flag { FlagName = "Publisher", IsAssigned = true },
        }
    },
    new Application { AppName = "Viewer App",
        Flags = new List<Flag> {
            new Flag { FlagName = "Editor", IsAssigned = false },
            new Flag { FlagName = "Baker", IsAssigned = true },
            new Flag { FlagName = "Search", IsAssigned = false },
        }
    }
};

(I just typed that out here, so there may be some code errors, but you get the idea)

So I want to use the RadGrid to display the list of all Applications, grouped by AppName, and then show the Flags for each Application below with a CheckboxColumn which will be set based on the IsAssigned bool for the Flag.  Is there an example somewhere that shows how to do this?  I've tried myself, and searched a bit but I can't find any sample code showing how to wire up a collection with a nested collection to a RadGrid. 

As always, your help is appreciated!

Thanks,
Eddie
Jesse
Top achievements
Rank 1
Veteran
 answered on 21 Aug 2013
1 answer
98 views
In the scheduler I'm using the timeline view and whole days.  When resizing an appointment start date it works fine.  When resizing the end date though it will offset it one day too far in the future.

So for instance if I have an appointment from 8/4 - 8/6, and I drag the end point to cover 8/7, the args.get_newEndTime() in the OnClientAppointmentResizeEnd event handler will return 8/8 not 8/7.

On the other hand, if I drag the start point of the same appointment the date reported by args.get_newEndTime() will still be the original value of 8/6.

This creates a problem since I don't see any way to detect in the OnClientAppointmentResizeEnd hander which end of the appointment is actually being resized.  The start and end dates on the appointment in args has already been changed.  Because of this I have to update both start and end dates when that occurs, which will in turn result an incorrect end date when the end point is resized vs. the start point.

Is there any way to detect in the OnClientAppointmentResizeEnd event handler which end of the appointment is being dragged so that I can account for this?  Or to get it to report the correct day?

ETA - the args._targetSlot._startTime will contain the correct date value for the target slot.  But there's still no way to tell for sure which end of the appointment is being resized.
Marbry
Top achievements
Rank 1
 answered on 21 Aug 2013
4 answers
191 views
Hi!
I have a hierarchical RadGrid with ClientSettings:
 <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" FrozenColumnsCount="1"/>
but horizontal scroll bar is not visible.
When I remove from grid DetailTables section, the horizontal scroll bar is visible and works fine.
How to fix this issue?
Mudassar
Top achievements
Rank 1
 answered on 21 Aug 2013
3 answers
607 views
Hi,

 I am trying to use Kendo UI with HTML 5 Chart, but its giving me error

 JavaScript runtime error: 'kendo' is undefined

Can anyone tell me what I am missing?


Thanks

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<script type="text/javascript">
    kendo.culture("<%= currCulture %>");
</script>
<!--Where currCulture is the variable storing the desired culture-->
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Height="400px" Width="400px">
    <PlotArea>
        <Series>
            <telerik:PieSeries>
                <SeriesItems>
                    <telerik:PieSeriesItem Exploded="true" Y="53000" Name="Q1" />
                    <telerik:PieSeriesItem Exploded="false" Y="35000" Name="Q2" />
                    <telerik:PieSeriesItem Exploded="false" Y="47500" Name="Q3" />
                    <telerik:PieSeriesItem Exploded="false" Y="22300" Name="Q4" />
                </SeriesItems>
                <LabelsAppearance DataFormatString="C">
                </LabelsAppearance>
                <TooltipsAppearance DataFormatString="C"></TooltipsAppearance>
            </telerik:PieSeries>
        </Series>
        <YAxis>
        </YAxis>
    </PlotArea>
    <ChartTitle Text="Revenue">
    </ChartTitle>
</telerik:RadHtmlChart>
Danail Vasilev
Telerik team
 answered on 21 Aug 2013
13 answers
196 views
I have a dock zone that uses many docks (around 20). The docks are fixed height by design, and the user may display or hide them in another control. The user may also define additional custom docks from a template.

The issue is I want to allow the user the ability to shrink and stretch the width.

After having set the Resizable proerty to true, the docks can be resized smaller, but cannot be resized larger. Is this by design and if so, is there a workaround?
Keith
Top achievements
Rank 2
 answered on 21 Aug 2013
4 answers
233 views
Hi all:

I've read quite a few similar threads, but none specifically like mine.  I have a page with a nested FormView > EditItemTemplate > RadTabStrip> RadMultiPageView > RadPageView.  I need to find the value of a textbox on one of the RadPageView, and am having trouble.  I'm using VB.NET, and need to get the value of this textbox in my CodeBehind file.  Any help out there, or is more detail required?
Terri-Lynn
Top achievements
Rank 1
 answered on 21 Aug 2013
1 answer
99 views
I'm using the RadEditor for a site and I need to be able to add images from sources on other sites. How do i insert and image from another location with RAD Editor?
Ianko
Telerik team
 answered on 21 Aug 2013
1 answer
68 views
I bought a version of Radcombo version 2.3.2.0 when it was sold separately.  It was for a project that ran in asp.net (in vb) Developed with VS 2005.
I am now trying to upgrade the project to VS 2010 and run with framework 4.0, but Radcombo gives an error on the web page.  I imagine this is because I am using the 2.0 DLL.
What do I need to do to get this working.
If I cant get a framework 4.0 version do I need to upgrade and how much does this cost.  I am only using this one control.
Many thanks for your help.
Mike Duncan
Nencho
Telerik team
 answered on 21 Aug 2013
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?