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

Data not binding....

5 Answers 107 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
raaj
Top achievements
Rank 1
raaj asked on 27 Dec 2011, 10:00 AM

Hi Team

I've desing in my web application as....

 <tr>
                                                                    <td>
                                                                        <asp:Panel runat="server" ID="uxJumpPanel">
                                                                            <telerik:RadListView ID="feeldChoices" runat="server">
                                                                                <ItemTemplate>
                                                                                    <table cellpadding="0" cellspacing="0">
                                                                                        <tr>
                                                                                            <td>
                                                                                                <telerik:RadTextBox runat="server" Text='<%# Eval("Text") %>' onkeyup="SyncListToCheckbox(this)"
                                                                                                    ID="uxItemText" Width="260">
                                                                                                </telerik:RadTextBox>
                                                                                                  <telerik:RadComboBox runat="server" ID="uxSelectPage1"  ></telerik:RadComboBox>
                                                                                            </td>
 
                                                                                            <td>
                                                                                                <img id="imageAdd" style="cursorpointer" runat="server" onclick="InitiateAjaxRequest('1,3,add|' + this.id + ',' + selectedDockId); SetUnsaved();"
                                                                                                    alt="Add field choice" border="0" src="Images/Add.png" />
                                                                                            </td>
                                                                                            <td>
                                                                                                <img id="imageDelete" style="cursorpointer" runat="server" onclick="InitiateAjaxRequest('1,3,remove|' + this.id + ',' + selectedDockId); SetUnsaved();"
                                                                                                    alt="Delete field choice" border="0" src="Images/Delete.png" />
                                                                                            </td>
                                                                                        </tr>
                                                                                    </table>
                                                                                </ItemTemplate>
                                                                            </telerik:RadListView>
                                                                        </asp:Panel>
                                                                    </td>
                                                                </tr>

actually am not able to bind the data to  "uxSelectPage1" radcombobox. It always shows empty. 

Where am doing wrong?

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Dec 2011, 11:18 AM
Hello,

Try the following code.
ASPX:
<asp:Panel runat="server" ID="uxJumpPanel" Width="500px" Height="500px" BackColor="LightCyan">
 ListView:
  <telerik:RadListView ID="RadListView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="CustomerID">
   <ItemTemplate>
    <table>
     <tr>
      <td>
       <telerik:RadComboBox ID="uxSelectPage1" DataSourceID="SqlDataSource1" DataTextField="CustomerID" DataValueField="CustomerID" runat="server">
       </telerik:RadComboBox>
      </td>
      <td>
       <asp:TextBox ID="TextBox1" runat="server" Text="Text"></asp:TextBox>
      </td>
     </tr>
    </table>
  </ItemTemplate>
</telerik:RadListView>
</asp:Panel>

Thanks,
Princy.
0
raaj
Top achievements
Rank 1
answered on 28 Dec 2011, 12:08 AM
Thanks for your prompt reply, I'll try and let you know. Before that is there any way to find all the controls inside that RadListview for ex, uxSelectPage1, TextBox1...

//Thanks

0
Princy
Top achievements
Rank 2
answered on 28 Dec 2011, 05:11 AM
Hello,

Try the following.
CS:
protected void RadListView1_ItemDataBound(object sender, Telerik.Web.UI.RadListViewItemEventArgs e)
 {
    if (e.Item is RadListViewDataItem)
     {
        TextBox txt = (TextBox)e.Item.FindControl("TextBox1");
        RadComboBox combo = (RadComboBox)e.Item.FindControl("uxSelectPage1");
     }
 }

Thanks,
Princy.
0
raaj
Top achievements
Rank 1
answered on 28 Dec 2011, 06:13 AM

Thanks Princy for your response.

But when am using the event as you sent, am getting the error 

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Unable to cast object of type 'Telerik.Web.UI.RadTextBox' to type 'System.Web.UI.WebControls.TextBox'.


//Thanks


0
Princy
Top achievements
Rank 2
answered on 28 Dec 2011, 09:47 AM
Hello,

Make sure you are using asp TextBox. If you are using RadTextBox,then access the control as RadTextBox instead of TextBox.

RadTextBox txt = (RadTextBox )e.Item.FindControl("TextBox1");

Thanks,
Princy.
Tags
General Discussions
Asked by
raaj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
raaj
Top achievements
Rank 1
Share this question
or