Hi,
I am evaluating Telerik to replace some controls we have for our project.
We are using a RadSearchBox, and when the user select an entry, based on the entry different things can happen.
One of them is that a popup open with a label inside displaying the user entry name.
So far I have the following
ASP
C#
Any help would be welcomed.
I am evaluating Telerik to replace some controls we have for our project.
We are using a RadSearchBox, and when the user select an entry, based on the entry different things can happen.
One of them is that a popup open with a label inside displaying the user entry name.
So far I have the following
ASP
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel2"
runat
=
"server"
>
<
telerik:RadSearchBox
ID
=
"RadSearchBox1"
runat
=
"server"
Width
=
"300px"
EmptyMessage
=
"Search..."
OnClientSearch
=
"aspButtonCallbackFn"
ShowSearchButton
=
"true"
>
<
DropDownSettings
Height
=
"400"
Width
=
"300"
/>
<
WebServiceSettings
Path
=
"Main.aspx"
Method
=
"GetResults"
/>
</
telerik:RadSearchBox
>
<
asp:Button
runat
=
"server"
ID
=
"Button6"
OnClick
=
"Button1_Click"
Style
=
"display: none"
/>
<
script
type
=
"text/javascript"
language
=
"javascript"
>
function aspButtonCallbackFn() {
__doPostBack('<%=Button6.UniqueID%>', "");
}
</
script
>
</
telerik:RadAjaxPanel
>
<
telerik:RadWindow
ID
=
"modalPopup"
runat
=
"server"
Width
=
"360px"
Height
=
"360px"
Modal
=
"true"
>
<
ContentTemplate
>
<
div
style
=
"height:100px; width:300px; text-align:center;"
>
<
asp:Table
runat
=
"server"
>
<
asp:TableRow
>
<
asp:TableCell
ColumnSpan
=
"2"
>
<
asp:Label
ID
=
"Lbl_Pnl_ForAdd"
runat
=
"server"
Text
=
""
/>
</
asp:TableCell
>
</
asp:TableRow
>
<
asp:TableRow
>
<
asp:TableCell
HorizontalAlign
=
"Center"
>
<
asp:Button
ID
=
"Bttn_Add"
Width
=
"100"
OnClick
=
"Bttn_Add_Click"
Text
=
"Add"
runat
=
"server"
class
=
"button"
/>
</
asp:TableCell
>
<
asp:TableCell
HorizontalAlign
=
"Center"
>
<
asp:Button
ID
=
"Bttn_Cancel_ForAdd"
Width
=
"100"
OnClick
=
"Bttn_Cancel_ForAdd_Click"
Text
=
"Cancel"
runat
=
"server"
class
=
"button"
/>
</
asp:TableCell
>
</
asp:TableRow
>
</
asp:Table
>
</
div
>
</
ContentTemplate
>
</
telerik:RadWindow
>
telerik:RadSearchBox
ID="RadSearchBox1"
runat="server"
Width="300px"
EmptyMessage="Search..."
OnClientSearch="aspButtonCallbackFn"
ShowSearchButton="true">
<
DropDownSettings
Height
=
"400"
Width
=
"300"
/>
<
WebServiceSettings
Path
=
"Main.aspx"
Method
=
"GetResults"
/>
</
telerik:RadSearchBox
>
<
asp:Button
runat
=
"server"
ID
=
"Button6"
OnClick
=
"Button1_Click"
Style
=
"display: none"
/>
<
script
type
=
"text/javascript"
language
=
"javascript"
>
function aspButtonCallbackFn() {
__doPostBack('<%=Button6.UniqueID%>', "");
}
</
script
>
<telerik:RadWindow
ID="modalPopup"
runat="server"
Width="360px"
Height="360px"
Modal="true">
<ContentTemplate>
<div style="height:100px; width:300px; text-align:center;" class="popup_Container">
<asp:Table runat="server">
<asp:TableRow>
<asp:TableCell ColumnSpan="2">
<asp:Label
ID="Lbl_Pnl_ForAddExistingInterest"
runat="server"
Text="" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell HorizontalAlign="Center">
<asp:Button
ID="Bttn_Add_ForAddExistingInterest"
Width="100"
OnClick="Bttn_Add_ForAddExistingInterest_Click"
Text="Add"
runat="server"
class="button" />
</asp:TableCell>
<asp:TableCell HorizontalAlign="Center">
<asp:Button
ID="Bttn_Cancel_ForAddExistingInterest"
Width="100"
OnClick="Bttn_Cancel_ForAddExistingInterest_Click"
Text="Cancel"
runat="server"
class="button" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</ContentTemplate>
</telerik:RadWindow>
C#
[WebMethod]
public
static
SearchBoxData GetResults(SearchBoxContext context)
{
return
SQLAccess.Instance.Search(context.Text);
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
try
{
string
selectedData = RadSearchBox1.Text;
Lbl_Pnl_ForAddExistingInterest.Text = String.Format(
"Do you want to add {0}?"
, selectedData);
RadAjaxPanel2.ResponseScripts.Add(String.Format(
"$find('{0}').ajaxRequest();"
, RadAjaxPanel2.ClientID));
string
script =
"function f(){$find(\""
+ modalPopup.ClientID +
"\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
;
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"key"
, script,
true
);
}
}
Any help would be welcomed.