protected
void DynamicRepeater_ItemCreated(Object sender, RepeaterItemEventArgs e)
{
IDictionary
<string, string> values = RetrieveValues();
RadComboBox combo= new RadComboBox();
//DropDownList combo= new DropDownList();
combo.ID =
"SomeId";
combo.DataSource = values;
combo.DataValueField =
"Key";
combo.DataTextField =
"Value";
e.Item.Controls.Add(combo)
}
There is another RadComboBox control named TypeComboBox with AutoPostBack="true" inside the FormView.
Whenever the TypeComboBox selection changes, the repeater needs to be rebound and the dynamic controls will be recreated inside the repeater.
So I added the following code to ajaxify the repeater:
protected void Page_PreRender(object sender, EventArgs e)
{
RadComboBox
typeComboBox = (RadComboBox)FormView1.FindControl("TypeComboBox ");
RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(typeComboBox , (Repeater)FormView1.FindControl("DynamicRepeater"));
}
This does not work.The point is when I replace the RadComboBox with an Asp DropDownList ,the ajax works fine.So I assume the problem might be happening by the RadComboBox.
Note that Ajaxifying the whole FormView is not an option for me, because I don't want to lose the data that user entered in the other controls in the FormView after selecting the Type.
I had a previous issue with the ajaxifying other controls like Panel and PlaceHolder inside a FormView(Support ID:228263 -- Problem with RadAjaxManager and Panel or PlaceHolder inside a FormView), but I am afraid the answer was not very saticefying because like I explained the whole FormView shouldn't be refreshed in my case.
What can I do to solve this issue?
Thanks in advance for your help.
Sima
| Imports Telerik.Web.UI |
| Partial Class _Default |
| Inherits System.Web.UI.Page |
| Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) |
| MyBase.OnLoad(e) |
| F(ph) |
| End Sub |
| Private Sub F(ByVal pane As Control, Optional ByVal limit As Integer = 10) |
| If limit <= 0 Then |
| Dim blah As New Literal() |
| blah.Text = " " |
| pane.Controls.Add(blah) |
| Exit Sub |
| End If |
| If TypeOf pane Is WebControl Then |
| Dim rand As New Random(pane.GetHashCode) |
| Dim r As Integer = rand.Next(100, 255) |
| Dim g As Integer = rand.Next(10, 255) |
| Dim b As Integer = rand.Next(50, 255) |
| CType(pane, WebControl).BackColor = System.Drawing.Color.FromArgb(r, g, b) |
| End If |
| Dim splitter As New RadSplitter() |
| splitter.Orientation = If(limit Mod 2 = 0, Orientation.Horizontal, Orientation.Vertical) |
| splitter.PanesBorderSize = 0 |
| Dim leftPanel As New RadPane() |
| leftPanel.Scrolling = SplitterPaneScrolling.None |
| F(leftPanel, limit - 1) |
| splitter.Items.Add(leftPanel) |
| Dim rightPanel As New RadPane() |
| rightPanel.Scrolling = SplitterPaneScrolling.None |
| F(rightPanel, limit - 1) |
| splitter.Items.Add(rightPanel) |
| Dim spacing As New Panel() |
| spacing.Style.Add("padding", "5px") |
| spacing.Controls.Add(splitter) |
| pane.Controls.Add(spacing) |
| End Sub |
| End Class |
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head runat="server"> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager runat="server" /> |
| <asp:PlaceHolder runat="server" ID="ph" /> |
| </form> |
| </body> |
| </html> |
<
telerik:GridTemplateColumn HeaderText="Notification" UniqueName="TemplateColumn"
EditFormColumnIndex="1" ReadOnly="false">
<ItemTemplate>
<%
# Eval("vchNewsText") %>
</ItemTemplate>
<EditItemTemplate>
<span><telerik:RadTextBox runat="server" ID="txtNotification" Width="750px" height="200px"
TextMode="MultiLine"
Text='<%# Bind("vchNewsText") %>'></telerik:RadTextBox><span></span>
</EditItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
s1 = (editedItem.FindControl(
"txtNotification") as TextBox).Text;
Hashtable newValues = new Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
s1=(string)newValues["TemplateColumn"];
Result-empty string;
So how do I extract the new value of Control in Template Column in Grid_ItemCommand procedure ?
I have a simple panel bar with itemtemplates, within the itemtemplate i have a table containing server controls. how would i access the server controls from the server side code? Findcontrol does not seems to work.
<asp:Panel ID="pnlStudentDetails" runat="server" Height="100%" Width="100%">
<telerik:RadPanelBar ID="radPnl" runat="server" Width ="70%" Skin="Sunset"
ExpandMode="MultipleExpandedItems">
<Items>
<telerik:RadPanelItem Text="Name" Expanded ="true" Font-Bold="True" runat="server">
<Items>
<telerik:RadPanelItem runat ="server">
<ItemTemplate>
<asp:Table ID="tblName" runat="server">
<asp:TableRow id="trRow1" runat ="server" Width ="10%">
<asp:TableCell rowspan="3" id="tcImage" runat ="server" CssClass="TableCell" ><asp:Image ID="imgStu" runat ="server" ImageUrl ="~/Images/logo.gif" BorderWidth ="1px"/></asp:TableCell>
<asp:TableCell id="tcFullName" ColumnSpan ="3" runat ="server" CssClass="TableCell"><asp:Label ID="lblFullName" runat ="server" Text ="FullName" CssClass="labelValueSrc"></asp:Label><asp:ImageButton ID="ImgAudio" runat ="server" ImageAlign="Right"/></asp:TableCell>
</asp:TableRow>
<asp:TableRow id ="trRow2" runat ="server" CssClass="TableCell">
<asp:TableCell id ="tcPrfName" runat ="server" CssClass="TableCell"><asp:Label ID="lblPrfName" runat ="server" Text="Preferred Name" CssClass="labelSrc"></asp:Label></asp:TableCell>
<asp:TableCell id="tcPrfNameValue" runat ="server" CssClass="TableCell"><asp:Label ID="lblPrfNameValue" runat="server" CssClass="labelValueSrc"></asp:Label></asp:TableCell>
</asp:TableRow>
<asp:TableRow id="trRow3" runat="server" CssClass="TableCell">
<asp:TableCell id="tcNotes" runat ="server" CssClass="TableCell"><asp:Label ID="lblNotes" runat="server" Text ="Notes/Messages" CssClass="labelSrc"></asp:Label></asp:TableCell>
<asp:TableCell id="tcNotesValue" runat="server" CssClass="TableCell"><asp:Label ID ="lblNotesValue" runat ="server" CssClass="labelValueSrc"></asp:Label></asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelItem>
</telerik:RadPanelItem>
</asp:Panel>
Hello,
I want to disable the RadGrid's ability to highlight and select rows when hovering over a row with the pointer. However, setting the appropriate attribute EnableRowHoverStyle has no effect, one can still highlight rows and select them.
| <ClientSettings EnableRowHoverStyle="False" Selecting-AllowRowSelect="False"> |
| <Selecting AllowRowSelect="false" EnableDragToSelectRows="False" /> |
| </ClientSettings> |
| protected void Grid1_SelectedIndexChanged(object sender, System.EventArgs e) |
| { |
| GridItem item = Grid1.SelectedItems[0] as GridItem; |
| Customer cust = item.DataItem as Customer; |
| } |
| <telerik:GridDropDownColumn DataField="answertype" DataSourceID="SqlDataSource3" |
| HeaderText="Answer Type" ListTextField="answertype" ListValueField="atID" |
| UniqueName="answertype" ColumnEditorID="GridDropDownColumnEditor1"> |
| </telerik:GridDropDownColumn> |