I have some ajax stuff on the page- fill one dropdown based on another dropdown's selection.
I also used Radcaptcha, when submit the page, the page alway not valid, unless putting the radcaptcha inside the UpdatePanel .
<asp:UpdatePanel ID="UpdatePanel7" runat="server">
<ContentTemplate>
<telerik:RadCaptcha ID="RadCaptcha1" Runat="server" ValidationGroup="Group"
ErrorMessage="Page not valid. The code you entered is not valid.Page not valid. The code you entered is not valid"
ImageStorageLocation="Session">
</telerik:RadCaptcha>
</ContentTemplate>
</asp:UpdatePanel>
This will solve page not valid problem, but everytime when the ajax fired (first dropdown is selected), the Radcaptcha's text got changed. Is there anyway that can prevent the Radcaptcha text changing everytime when the ajax fired?
Thanks
Hi,
I have created a RadGrid with self-referencing hierarchy without a problem. But as we are having some performance issues I don't have the luxure to send/receive big page sizes each time. So I send the grid empty without binding the data on needDataSource event. Then I get the data with ajax in json format which is quite small. The problem is I cannot find a client side event, which formats the data with the given hierarchical structure. Is there a way for that or do I need to write a custom javascript function to create that structure?
Where should I assign the filter expression on client side, which I do on server side like t.MasterTableView.FilterExpression = @"it[""PARENT""] = Convert.DBNull";
Given code creates the grid and binds the data but without a structure.
Thanks in advance,
Cem
<
telerik:RadGrid
ID
=
"t"
runat
=
"server"
AutoGenerateColumns
=
"false"
AllowPaging
=
"True"
HierarchyDefaultExpanded
=
"false"
HierarchyLoadMode
=
"Client"
AllowSorting
=
"True"
PageSize
=
"10"
>
<
mastertableview
datakeynames
=
"CHILD,PARENT"
>
<
SelfHierarchySettings
ParentKeyName
=
"PARENT"
KeyName
=
"CHILD"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"CHILD"
HeaderText
=
"CHILD"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PARENT"
HeaderText
=
"PARENT"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"AMOUNT"
HeaderText
=
"AMOUNT"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
mastertableview
>
<
clientsettings
allowexpandcollapse
=
"true"
selecting-allowrowselect
=
"true"
enablerowhoverstyle
=
"false"
>
<
Scrolling
AllowScroll
=
"True"
ScrollHeight
=
"400px"
UseStaticHeaders
=
"True"
/>
</
clientsettings
>
</
telerik:RadGrid
>
Sys.Application.add_init(
function
() {
var
grid = $find(
"<%=t.ClientID%>"
);
var
tableView = grid.get_masterTableView();
var
id = grid.get_element().id;
var
objData = {
id: id,
startIndex: tableView.get_currentPageIndex(),
pageSize: tableView.get_pageSize(),
};
$.ajax({
type:
"POST"
,
url: url,
data: Sys.Serialization.JavaScriptSerializer.serialize({ data: objData }),
contentType:
"application/json; charset=utf-8"
,
success:
function
(arg) {
//create an array with coming data and assign it
tableView.set_dataSource(arr);
tableView.dataBind();
},
before:
function
() {
},
error:
function
() {
}
});
<span id="RadDock1_C_val1_wrapper" class="RadInput RadInput_Default" style="white-space:nowrap;"> <input type="text" size="20" id="RadDock1_C_val1_text" name="RadDock1_C_val1_text" class="riTextBox riEnabled" style="width:125px;" /> <input id="RadDock1_C_val1" name="RadDock1$C$val1" class="rdfd_" style="visibility:hidden;margin:-18px 0 0 -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;" type="text" value="" /> <input id="RadDock1_C_val1_ClientState" name="RadDock1_C_val1_ClientState" type="hidden" /></span>And my javascript code - var test = $find("<%=RadDock1.ContentContainer.FindControl("val1").ClientID %>");
Hi,
I found a problem on the radcombobox on my radgrid. If I selected couple of values from the combobox by using autocomplete separator & click update, it didn't work at all. If I selected only one value from the combobox, it could be updated properly on the table on my sql database.
Can any of you tell me what is wrong ?
<%@ Page Language="VB" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadCombobox1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"
Transparency="50">
<div style="background-color: #FFFFFF; height: 100%;">
<asp:Image ID="Image1" runat="server" ImageUrl="loading1.gif"
AlternateText="loading" ImageAlign="AbsMiddle" />
</div>
</telerik:RadAjaxLoadingPanel>
<br />
<br />
<telerik:RadComboBox ID="RadComboBox1" Runat="server"
DataSourceID="SqlDataSource3" DataTextField="F5" DataValueField="F5"
Height="20px" MaxHeight="500px" Width="412px" AutoPostBack="True"
Skin="WebBlue" AppendDataBoundItems="True">
<Items>
<telerik:RadComboBoxItem value="0", Text="Please select your name..." />
</Items>
</telerik:RadComboBox>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:usagelogConnectionString %>"
SelectCommand="SELECT DISTINCT F5 FROM OriginalReport"></asp:SqlDataSource>
<br />
<br />
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
GridLines="None" Skin="WebBlue" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" >
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_WebBlue"></HeaderContextMenu>
<MasterTableView DataKeyNames="F1"
DataSourceID="SqlDataSource1" CommandItemDisplay="TopAndBottom">
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit" >
<HeaderStyle Width="10px" />
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="F1" DataType="System.Int32" HeaderText="ID#"
ReadOnly="True" SortExpression="F1" UniqueName="F1"
FilterControlAltText="Filter F1 column">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="F2"
FilterControlAltText="Filter F2 column" HeaderText="Publication Date"
UniqueName="F2">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn DataField="F3" HeaderText="DocID" SortExpression="F3"
UniqueName="F3" FilterControlAltText="Filter F3 column">
</telerik:GridBoundColumn>
<telerik:GridHTMLEditorColumn DataField="F4"
FilterControlAltText="Filter F4 column" HeaderText="Report Title"
UniqueName="F4">
</telerik:GridHTMLEditorColumn>
<telerik:GridBoundColumn DataField="F5" FilterControlAltText="Filter F5 column"
HeaderText="Written by..." SortExpression="F5" UniqueName="F5">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="F6" FilterControlAltText="Filter F6 column"
HeaderText="Written by..." SortExpression="F6" UniqueName="F6">
</telerik:GridBoundColumn>
<telerik:GridDropDownColumn DataField="F7" DataSourceID="SqlDataSource5"
FilterControlAltText="Filter F7 column" HeaderText="Content Type"
ListTextField="F1" ListValueField="F1" UniqueName="F7">
</telerik:GridDropDownColumn>
<telerik:GridDropDownColumn DataField="F8" DataSourceID="SqlDataSource4"
FilterControlAltText="Filter F8 column" HeaderText="Industry"
ListTextField="F1" ListValueField="F1" UniqueName="F8">
</telerik:GridDropDownColumn>
<telerik:GridTemplateColumn DataField="F9"
FilterControlAltText="Filter F9 column" HeaderText="Global Vendor"
UniqueName="F9">
<EditItemTemplate>
<telerik:RadComboBox ID="F9RadComboBox" runat="server" AllowCustomText="True"
AutoCompleteSeparator=";" DataSourceID="SqlDataSource2" DataTextField="F1"
DataValueField="F1" Height="19px" MarkFirstMatch="True"
SelectedValue='<%# Bind("F9") %>' Width="504px" MaxHeight="500px" >
</telerik:RadComboBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="F9Label" runat="server" Text='<%# Eval("F9") %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="F10" FilterControlAltText="Filter F10 column"
HeaderText="Vendor manual input" SortExpression="F10" UniqueName="F10">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1" >
</EditColumn>
</EditFormSettings>
<CommandItemSettings ShowExportToCsvButton="True" ShowExportToExcelButton="True"
ShowExportToPdfButton="True" ShowExportToWordButton="True" />
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:usagelogConnectionString %>"
DeleteCommand="DELETE FROM [OriginalReport] WHERE [F1] = @F1"
InsertCommand="INSERT INTO [OriginalReport] ([F2], [F3], [F4], [F5], [F6], [F7], [F8], [F9], [F10]) VALUES (@F2, @F3, @F4, @F5, @F6, @F7, @F8, @F9, @F10)"
SelectCommand="SELECT [F1], [F2], [F3], [F4], [F5], [F6], [F7], [F8], [F9], [F10] FROM [OriginalReport] WHERE ([F5] = @F5)"
UpdateCommand="UPDATE [OriginalReport] SET [F2] = @F2, [F3] = @F3, [F4] = @F4, [F5] = @F5, [F6] = @F6, [F7] = @F7, [F8] = @F8, [F9] = @F9, [F10] = @F10 WHERE [F1] = @F1">
<SelectParameters>
<asp:ControlParameter ControlID="RadComboBox1" Name="F5"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="F1" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="F2" Type="DateTime" />
<asp:Parameter Name="F3" Type="String" />
<asp:Parameter Name="F4" Type="String" />
<asp:Parameter Name="F5" Type="String" />
<asp:Parameter Name="F6" Type="String" />
<asp:Parameter Name="F7" Type="String" />
<asp:Parameter Name="F8" Type="String" />
<asp:Parameter Name="F9" Type="String" />
<asp:Parameter Name="F10" Type="String" />
<asp:Parameter Name="F1" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="F2" Type="DateTime" />
<asp:Parameter Name="F3" Type="String" />
<asp:Parameter Name="F4" Type="String" />
<asp:Parameter Name="F5" Type="String" />
<asp:Parameter Name="F6" Type="String" />
<asp:Parameter Name="F7" Type="String" />
<asp:Parameter Name="F8" Type="String" />
<asp:Parameter Name="F9" Type="String" />
<asp:Parameter Name="F10" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:usagelogConnectionString %>"
SelectCommand="SELECT * FROM [Vendors] ORDER BY [F1]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$ ConnectionStrings:usagelogConnectionString %>"
SelectCommand="SELECT * FROM [Industry] ORDER BY [F1]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource5" runat="server"
ConnectionString="<%$ ConnectionStrings:usagelogConnectionString %>"
SelectCommand="SELECT * FROM [contenttype] ORDER BY [F1]">
</asp:SqlDataSource>
</form>
</body>
</html>
Posted on Jan 20, 2011 (permalink)