<telerik:RadComboBox ID="ddlLineNum" runat="server" DataValueField="all_line_id" DataTextField="line_number" Width="250px" Skin="Windows7" HighlightTemplatedItems="True" DropDownWidth="290px" AutoPostBack="True"> <ItemTemplate> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td style="width: 75px;"> <%#DataBinder.Eval(Container.DataItem, "line_number")%> </td> <td style="width: 200px; padding-left: 5px;"> <%#DataBinder.Eval(Container.DataItem, "line_description")%> </td> </tr> </table> </ItemTemplate> </telerik:RadComboBox> I'm creating my first Visual Web Part project with Visual Studio 2010 (C#). The purpose of this simple project is to become better aquainted with the RadGrid control. There are basically two parts to it:
1. Add RadGrid control and bind to datasource using C#. The RadGrid has an edit and delete column.
2. Add a RadTextBox control to display the captured content of a specific cell when I click on the update option when editing the record.
Part 1 is pretty straightforward and seems to work fine. Here is the code that I run upon page load:
private void bindGrid(RadGrid grid) { string qry = "SELECT Recipient, Email FROM Table1"; SqlConnection conn = new SqlConnection(connection string); SqlCommand cmd = new SqlCommand(qry, conn); SqlDataAdapter adapter = new SqlDataAdapter(cmd); DataTable recipients = new DataTable(); try { conn.Open(); adapter.Fill(recipients); } catch (Exception ex) { } finally { grid.DataSource = recipients; grid.DataBind(); conn.Close(); } }protected void Update_Command(object sender, GridCommandEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; RadTextBox1.Text = dataItem["recipient"].Text.ToString(); } else if (e.Item is GridEditFormItem) { } }Instead of getting the persons name displayed in the cell, all I get is " "; I've tried this several different ways, even using
the NeedDataSource method. The result is always the same.
Out of curiousity I counted the columns in the RadGrid immediately after binding with RadGrid1.columns.count and get 0. So the RadGrid displays the data from the datasource properly on page load, but I can't seem to access any of that data.
I can't figure this out and any guidance would be greatly appreciated.
<Scrolling SaveScrollPosition="true" AllowScroll="true" UseStaticHeaders="true" />
.rgDataDiv { position: relative !important; }as i noticed the parent scrollable control is a div with the class i mentioned before...and still the same problem within IE7.
I attach the grid control definition :
<telerik:RadGrid ID="gridCases" runat="server" AllowPaging="true" AllowCustomPaging="false" PageSize="30" Width="894px" EnableAjaxSkinRendering="true" GridLines="None" Height="455" AllowSorting="true" style="border-left-style:none !important; border-right-style:none !important; position:relative;">I attach also the FilterTempalte part of the slider:
<div style="float:left; padding: 5px 7px 0 0;">$0</div> <div style="float:left;"> <telerik:RadSlider runat="server" ID="RadSlider1" IsSelectionRangeEnabled="true" MinimumValue="0" MaximumValue="1010" SmallChange="5" ShowDecreaseHandle="false" ShowIncreaseHandle="false" Width="120px" SelectionStart='<%# startSlider %>' SelectionEnd='<%# endSlider %>' OnClientValueChanged="ClientValueChange" OnClientSlideStart="ClientSlideStart" OnClientSlideEnd="FreightRangeChanged" /> </div> <div style="float: left; padding: 5px 0 0 7px">$1000</div> <div style="clear: both"> <asp:Literal ID="Literal1" runat="server" Text='<%# "Showing: $" & startSlider & " to $" & endSlider %>' /> </div>