Hello,
On my page I have a ComboBox where the user can choose a name and I also have a TextBox where the user can enter one or more values. I am trying to figure out how to take the value from the ComboBox (w/ @Name parameter) and the value(s) from the TextBox (w/ @ProductNum parameter(s))
and use those as Parameters together (@Name, @ProductNum) in a Procedure that I have created when I click the Generate Template button.
I am stuck and I am not sure what my next step should be. Any help would be appreciated.
aspx
.cs
I have also attached a pic of what my current page looks like.
Thank you,
Brett
On my page I have a ComboBox where the user can choose a name and I also have a TextBox where the user can enter one or more values. I am trying to figure out how to take the value from the ComboBox (w/ @Name parameter) and the value(s) from the TextBox (w/ @ProductNum parameter(s))
and use those as Parameters together (@Name, @ProductNum) in a Procedure that I have created when I click the Generate Template button.
I am stuck and I am not sure what my next step should be. Any help would be appreciated.
aspx
<%@ Page Title="Product Template" Language="C#" MasterPageFile="~/MasterPages/M.Master" AutoEventWireup="true" CodeBehind="ProductTemplate.aspx.cs" Inherits="ProductTemplate" Theme="Default" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"MainContent"
runat
=
"server"
ViewStateMode
=
"Inherit"
>
<
style
>
.addButton
{
float: right;
display: block;
}
</
style
>
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
Height
=
"300px"
Width
=
"450px"
>
<
table
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"NameLbl"
runat
=
"server"
Text
=
"Name: "
Width
=
"120px"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"NameRCB"
runat
=
"server"
AutoPostBack
=
"True"
DataSourceID
=
"dllDataSource"
DataTextField
=
"Customer_Name"
DataValueField
=
"Customer_Name"
Width
=
"200px"
AppendDataBoundItems
=
"true"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"- Name -"
Value
=
"0"
Selected
=
"true"
></
telerik:RadComboBoxItem
>
</
Items
>
</
telerik:RadComboBox
>
</
td
>
<
td
></
td
>
<
td
>
<
asp:Label
ID
=
"ProductLbl"
runat
=
"server"
Text
=
"Product: "
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"ProductTB"
runat
=
"server"
>
</
telerik:RadTextBox
>
</
td
>
<
td
></
td
>
<
td
>
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"RequiredFieldValidator1"
Display
=
"None"
ControlToValidate
=
"ProductTB"
ErrorMessage
=
"Enter a Product Number"
></
asp:RequiredFieldValidator
>
<
telerik:RadButton
ID
=
"RbSelect"
runat
=
"server"
Text
=
" Select "
onclick
=
"RbSelect_Click"
/>
</
td
>
</
tr
>
</
table
><
br
/>
<!-- list -->
<
telerik:RadListBox
ID
=
"RadListBox1"
runat
=
"server"
Height
=
"250px"
>
</
telerik:RadListBox
>
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
TextMode
=
"MultiLine"
Height
=
"250px"
Width
=
"200px"
>
</
telerik:RadTextBox
>
</
telerik:RadAjaxPanel
>
<
br
/>
<
telerik:RadButton
ID
=
"RbGenerate"
runat
=
"server"
Text
=
"Generate Template"
style
=
"margin-left: 150px"
onclick
=
"RbGenerate_Click"
>
</
telerik:RadButton
>
<
br
/>
<
br
/>
<
asp:ValidationSummary
runat
=
"server"
ShowMessageBox
=
"false"
ID
=
"ValidationSummary1"
>
</
asp:ValidationSummary
>
<!-- datasource for RadComboBox -->
<
asp:SqlDataSource
ID
=
"dllDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="dbo.DropDownPROC" SelectCommandType="StoredProcedure" >
</
asp:SqlDataSource
>
<!-- datasource for grid -->
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
EnableAJAX
=
"true"
DefaultLoadingPanelID
=
"RadAjaxLoadingPanel1"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"NameRCB"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"OrdersGrid"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"NameRCB"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Skin
=
"Default"
>
</
telerik:RadAjaxLoadingPanel
>
</
asp:Content
>
.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Data;
namespace EE.Intranet.Purchasing
{
public partial class ProductTemplate : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RbSelect_Click(object sender, EventArgs e)
{
RadTextBox1.Text = ProductTB.Text;
RadListBox1.Items.Add(new RadListBoxItem(HttpUtility.HtmlEncode(ProductTB.Text.Trim())));
ProductTB.Text = string.Empty;
}
protected void RbGenerate_Click(object sender, EventArgs e)
{
/*using (SqlConnection conn = new SqlConnection("connection1"))
{
conn.Open();
SqlCommand comm = new SqlCommand("dbo.sp_Proccccc", conn);
comm.CommandType = CommandType.StoredProcedure;
comm.Parameters.Add(new SqlParameter("@Name", Name));
comm.Parameters.Add(new SqlParameter("@ProductNum", ProductNumber));
comm.ExecuteNonQuery();
conn.Close();
}*/
}
}
}
I have also attached a pic of what my current page looks like.
Thank you,
Brett