Item Insert Template Disappearing ?

4 posts, 1 answers
  1. Tahir Ahmed
    Tahir Ahmed avatar
    11 posts
    Member since:
    May 2011

    Posted 14 May 2011 Link to this post

    Hello,

    I have just started using RadControls so this question might be basic for you, I am using a List View which I am populating using Sql Data Source, I also have insert functionality in that List View but the problem is the insert template just disappear after adding one record and I have to refresh the page to make insert template appear again, am I doing something wrong ?

    Edit: I have another question regarding List View, is it possible that we use a drop down box instead of a text box inside insert template ? because sometimes you want to restrict the users to pick from predefined values instead of letting them enter anything ? I have tried putting drop down box inside insert template using code view of visual studio and it also appears properly when I run the page but the problem is data binding is not working, I have tried using
    SelectedValue=<%# Bind("field_name") %>
    but it does not work for some reason.

    Please advice,
    Thanks.
  2. Answer
    Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 19 May 2011 Link to this post

    Hi Tahir,

    I tried to replicate the problem you are facing with insert template in this online example, but to no avail. Check it out and see what is the difference in your case.

    Regarding your next question, I suggest that you examine the code snippet below and see if it works for you:
    ASPX:
    <InsertItemTemplate>
            <table cellpadding="0" cellspacing="0" style="width: 370px;">
                 <tr>
                    <td>Name:</td>
                        <td><asp:DropDownList runat="server"  ID="DropDownList3" AppendDataBoundItems="true" DataTextField="Name"
                         DataValueField="CustomerName" DataSourceID="SqlDataSource2">
                         <asp:ListItem Text="" Value=""></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </td>
                 </tr>
            </table>
         </InsertItemTemplate>

    Regards,
    Pavlina
    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tahir Ahmed
    Tahir Ahmed avatar
    11 posts
    Member since:
    May 2011

    Posted 25 May 2011 Link to this post

    Thanks Pavlina and sorry for late answering back.

    The aspx code you provided solved my problem, thanks again.

    regarding my first question, I managed to solve it myself by some fiddling around with properties, at first I found a relatively inefficient way to solve the problem in which if the user has to enter another record he/she has to click a button "Add Another Record" to make insert template appear again. Here is the code:

        protected void btnAddAnother_Click(object sender, EventArgs e)
        {
            RLVUsers.ShowInsertItem(RadListViewInsertItemPosition.LastItem);
        }

    But consider if a user has to enter around 50 or more records he/she has to click that button after each record. After spending some more time with it I found this and it is exactly what I was looking for.

        protected void RLVUsers_ItemInserted(object sender, RadListViewInsertedEventArgs e)
        {
            e.KeepInInsertMode = true;
        }

    This prevents the insert template from disappearing. Hope this helps someone in similar problem.

    Regards,
    Tahir Ahmed.
  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 25 May 2011 Link to this post

    Hello Tahir,

    I am glad you managed to get things working. Do not hesitate to contact us if other questions or problems arise.

    Best wishes,
    Pavlina
    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.

Back to Top