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

Item Insert Template Disappearing ?

3 Answers 76 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Tahir Ahmed
Top achievements
Rank 1
Tahir Ahmed asked on 14 May 2011, 11:13 PM
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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 19 May 2011, 03:45 PM
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.

0
Tahir Ahmed
Top achievements
Rank 1
answered on 25 May 2011, 11:16 AM
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.
0
Pavlina
Telerik team
answered on 25 May 2011, 12:59 PM
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.

Tags
ListView
Asked by
Tahir Ahmed
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Tahir Ahmed
Top achievements
Rank 1
Share this question
or