1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Custom Module

10 posts, 0 answered
  1. subodh
    subodh avatar
    24 posts
    Registered:
    25 Mar 2009
    28 Apr 2009
    Link to this post
    Hi,
    I have gone through the sample contact module blog written by Ivan.
    I followed the step as mentioned in the blog and it worked fine and got implemented.

    But our requirement is
    We need to create a custom module called contact which is very similar to one that Ivan has written,but here we want to show the contact editor to the user, so that the user  enters the details and the data gets stored in the DB.The admin section will include only the list of all contacts with edit,delete features.

    its really urgent for us and i request you to send the reply asap.

    Thanks
    subodh.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    28 Apr 2009
    Link to this post
    Hi subodh,

    If you have run the module correctly, you should be able to see that there have been created two new tables in your database which stores the data. The tables are sf_contacts_Contact and sf_contacts_Department. In this implementation we have used ObjectDdatasource control to retrieve and update data.

    Another option for changing the users section is replacing the current implementation and provider and using MembershipUser when managing users.

    I hope this helps.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. subodh
    subodh avatar
    24 posts
    Registered:
    25 Mar 2009
    28 Apr 2009
    Link to this post
    Hi,
    Thanks for reply
    I know that we have two tables in DB

    everything is working fine

    but our requirement is to display the UI for entering the data in the application not in the sitefinity admin section.In admin we have to show only the list of contacts and edit,delete features.

    Though the site user enters the data in the contact form not in the sitefinity admin

    Thanks
    subodh.
  4. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    28 Apr 2009
    Link to this post
    Hello subodh,

    it is very simple to implement the functionality you are looking for. Namely, you have the data layer and business layer already done, if you are using Contacts module. So all you have to do is following:

    1. Create a new control - you can name it let's say "PublicContactEditor". If you wish to use embedded templates you can inherit from SimpleControl class as explained here.
    2. In the template you will create the form with all the needed controls and implement the logic that works with ContactsManager
    - Actually, you can use the ContactEditor control for this which is already there, perhaps some minor tweaks will be needed, but probably 95% of the function will work.
    3. Create the new ToolboxItem for this control (Toolbox item is a class which carries information about public controls. You can take a look at the SingleContactToolboxItem class to see how to implement it).
    4. Finally, register this new control as a public control. To do so, open the ContactsModule and locate the
    IList<IToolboxItem> Controls property. Add the instance of ToolboxItem class you've created in the step 3 to the list.

    Now, you will have a public control which you can drag on the pages that can insert or edit contacts, so the visitors of your site will be able to work with contacts as well (not just the site administrators).

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    All the best,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. subodh
    subodh avatar
    24 posts
    Registered:
    25 Mar 2009
    29 Apr 2009
    Link to this post
    Hi Ivan,
    I really appreciate for the quick reply
    Thanks alot

    I have another problem
    we haven,t used the RadGrid code of ContactsItemsList.ascx(predefined code).we have customized it and not using any javascript(predefined)  code for edit and delete options for each and every contact in the radgrid.

    Instead we are adding one event handler to the radgrid in ContactsItemsList.cs(codebehind),which has a code to delete the single contact.
    Now the problem is, the event handler doesn't fire and the code doesn't get executed.

    for example

    in ContactsItemsList.cs

    we added

    radgrid1.itemdeleted+=new eventhandler(radgrid1_itemdeleted);

    void radgrid1_itemdeleted(object sender, gridDeleteEventArgs e)
    {
        //here the code for getting the id of the row.
    }
    and we are using "gridbuttoncolumn" for the delete link.

    my problem gets solved if the above event fires.


    Thanks
    Subodh.
  6. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    30 Apr 2009
    Link to this post
    Hello subodh,

    ItemDeleted event is fired after the grid (automatically) deletes the item. This is done if you have specified delete method on your datasource and AllowAutomaticDeletes on the RadGrid. Usually this event is used for some post delete actions, such as showing the message "Item was deleted."

    What you are looking for is actually, ItemCommand event. On your GridButtonColumn set the command name to "DeleteItem" and then in ItemCommand event handler make a condition (if e.CommandName == "DeleteItem") { // delete item code }).

    You can find more information about RadGrid server-side API here:
    http://www.telerik.com/help/aspnet-ajax/grdgettingfamiliarwithserverapi.html

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    All the best,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. subodh
    subodh avatar
    24 posts
    Registered:
    25 Mar 2009
    30 Apr 2009
    Link to this post
    Thanks Ivan,

    I got it worked.

    I have taken itemcommand event in the code behind and delete functionality is working fine.
    Now coming to EDIT functionality i am using "GridEditCommandColumn" in the code behind and adding it to the gridview column.
    We get an EDIT link,when we click it generates a form just below the row with the data and two links "update" and "cancel".
    Now the problem is
    When i edit the field values in the form and click on update it is not  getting updated.
    I have tried with the updatecommand and editcommand events.

    editcommand gets fired when i click on edit in the radgrid but after that should i write any event for the update link(for the form)?

    updatecommand event is not at all gets fired.

    suggest whether i am going in right direction or not?

    what should be the event for the update link?
    or
    do we have any other way to implement EDIT functionality

    Thanks
    Subodh.

  8. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    30 Apr 2009
    Link to this post
    Hello subodh,

    have you wired up the OnUpdateCommand event like in this sample:
    <telerik:RadGrid ID="RadGrid1" runat="server" Width="96%" GridLines="None" 
                AutoGenerateColumns="False" PageSize="13" AllowSorting="True" AllowPaging="True" 
                OnUpdateCommand="RadGrid1_UpdateCommand" OnNeedDataSource="RadGrid1_NeedDataSource" 
                ShowStatusBar="true" OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand"

    You can find the working example of this approach (together with the source code) here:
    http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editmodes/defaultcs.aspx

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    Kind regards,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. subodh
    subodh avatar
    24 posts
    Registered:
    25 Mar 2009
    01 May 2009
    Link to this post
    Hi,
    AS the location of code behind and .aspx are different,when  we wire up any event in the .aspx to the radgrid, it doesn't get fired.so what we did is we are binding the event to the control in the code behind and updatecommand event is not working,because the auto generated form for edit has two links update and cancel so we need to wire up the event for update link,as it is auto generated we cannot get the control to bind the event.

    So what are trying to do is we are creating one user control with the form fields and trying to redirect to this page on an editcommand event.But the problem is its not redirecting to the user control
    this is the code which iam sending take a look at it.

    contactslistitem.aspx

     <div id="gridPlaceholder">
              <asp:ObjectDataSource ID="odsContact" runat="server"></asp:ObjectDataSource>
              <telerik:RadGrid ID="contactsGrid" runat="server" AutoGenerateColumns="False" EnableViewState="false" Skin="SitefinityItems" EnableEmbeddedSkins="false" AllowAutomaticDeletes="false" AllowAutomaticUpdates="false" >
                                                        
                
                <MasterTableView AllowMultiColumnSorting="false" CssClass="listItems listItemsBindOnClient" Width="98%" DataKeyNames="ID">
                    
                    <Columns>
                       
                        <telerik:GridBoundColumn DataField="LastName" UniqueName="LastName" HeaderText="LastName" />
                        <telerik:GridBoundColumn DataField="FirstName" UniqueName="FirtsName" HeaderText="FirstName" />
                        <telerik:GridBoundColumn DataField="Title" UniqueName="Title" HeaderText="Title" />
                        <telerik:GridBoundColumn DataField="Phone" UniqueName="Phone" HeaderText="Phone" />
                        <telerik:GridBoundColumn DataField="EMail" UniqueName="EMail" HeaderText="EMail" />
                        
                    
                    </Columns>
                
                </MasterTableView>

    contactslistitem.cs

     GridButtonColumn btnDelete=new GridButtonColumn();
                btnDelete.Text="Delete";
                btnDelete.CommandName="Delete";
                btnDelete.ButtonType=GridButtonColumnType.LinkButton;
                ContactsGrid.MasterTableView.Columns.Add(btnDelete);
                ContactsGrid.ItemCommand += new GridCommandEventHandler(ContactsGrid_ItemCommand);
                
                GridEditCommandColumn edit = new GridEditCommandColumn();
                edit.ButtonType = GridButtonColumnType.LinkButton;
                edit.UniqueName = "EditCommandColumn";
                ContactsGrid.MasterTableView.Columns.Add(edit);
                
                ContactsGrid.UpdateCommand += new GridCommandEventHandler(ContactsGrid_UpdateCommand);

      void ContactsGrid_UpdateCommand(object source, GridCommandEventArgs e)
            {
                         
            }

    The above update command doesn't get fired as it is not wired up to the autogenerated form's update link.
    Any suggestions?
  10. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    06 May 2009
    Link to this post
    Hi,

    I am not sure why you have the RadGrid in an external page. Is it an option to place in the necessary view-template code behind in your custom module?

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
10 posts, 0 answered