This is a migrated thread and some comments may be shown as answers.

Using Command Line To Open FormView In NestedView

2 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 24 May 2011, 08:37 PM
I currently have a radGrid which opens an asp FormView in the NestedViewTemplate like so:

<NestedViewTemplate>
         <asp:Label ID="CurrentUser" runat="server" Text='<%# Bind("user_id") %>' Visible="false"></asp:Label>
        <asp:SqlDataSource ID="sqlds_SelectedUser" runat="server"
            ConnectionString="<%$ ConnectionStrings:M_ConnectionString %>"
            SelectCommand="SELECT * FROM [d_users] WHERE ([user_id] = @user_id)">
            <SelectParameters>
                <asp:ControlParameter Name="user_id" Type="Int32" ControlID="CurrentUser" PropertyName="Text" />
            </SelectParameters>
        </asp:SqlDataSource>
            <asp:FormView ID="form_DUser" runat="server" DataKeyNames="user_id"
                DataSourceID="sqlds_SelectedUser" Width="100%">
....

This is perfect for viewing and editing the record, however, how do I open the FormView in InsertMode when a user clicks the Grid's command item "Add New Record" link?

I want the grids add new record command to display the form that is in the NestedViewTemplate, and change its mode to form_DUser.ChangeMode(FormViewMode.Insert)

Is this possible?

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 28 May 2011, 12:51 PM
Hello Shawn,

A possible approach would be to put the formview in edit form template as shown below:
<MasterTableView ....>
     ......
    <EditFormSettings EditFormType="Template">
        <FormTemplate>
           your code
        </FormTemplate>
    </EditFormSettings>
</MasterTableView>

Form Template Edit Form demo
Inserting values using UserControl/FormTemplate
Updating values using UserControl/FormTemplate

Best regards,
Daniel
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Alon
Top achievements
Rank 1
answered on 24 Jul 2011, 11:13 AM
Hello Shawn,

I Have same the issue with FormView can't present his Insert mode when user clicks the "Add new" button.

Did you got solution for this?

I'll be glad to know about it.

Thanks ,

Alon
Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Alon
Top achievements
Rank 1
Share this question
or