or

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="KioskList.aspx.cs" Inherits="PAMRewrite.KioskList" %><%@ Register Src="PAMStats.ascx" TagName="PAMStats" TagPrefix="uc1" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <div id="pagecontent" class="well"> <uc1:PAMStats ID="PAMStats1" runat="server" Visible="false" /> <h3 runat="server" id="h1">Kiosk List</h3> <asp:UpdatePanel runat="server" ID="updaPnlKioskList" UpdateMode="Conditional" Visible="true"> <ContentTemplate> <telerik:RadCodeBlock runat="server" ID="rdbScripts"> <script type="text/javascript"> function openRadWin(URL) { var width = 1000; var height = 800; var left = 600; var top = 100; var wnd = radopen(URL, null, width, height, left, top); wnd.add_close(OnClientClose); } function OnClientClose(sender, args) { window.location.reload(true); } </script> </telerik:RadCodeBlock> <telerik:RadAjaxPanel runat="server"> <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true" Top="100" Left="600" Height="800" Width="1000" > <Windows> <telerik:RadWindow ID="RadWindow1" runat="server" ShowContentDuringLoad="false" Style="z-index: 8000" Title="CAO" Behaviors="Default" > </telerik:RadWindow> </Windows> </telerik:RadWindowManager> </telerik:RadAjaxPanel> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadWindowManager1"> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="gvKiosk"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="gvKiosk" LoadingPanelID="RadAjaxLoadingPanel1"> </telerik:AjaxUpdatedControl> <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1"></telerik:AjaxUpdatedControl> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"> </telerik:RadAjaxLoadingPanel> <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="Default" AutoCloseDelay="7000" Width="325" Height="275" runat="server" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element" Position="MiddleRight"> </telerik:RadToolTipManager> <p>This list contains Pre-Accounts that were created using the CAO Kiosk. The Signup Step shows the current status of the Pre-Account</p> <asp:UpdatePanel runat="server" ID="upReadyToAssignSearch" UpdateMode="Conditional"> <ContentTemplate> <telerik:RadGrid ID="gvKiosk" runat="server" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True" GridLines="None" CellSpacing="0" OnItemDataBound="gvKiosk_ItemDataBound" OnItemCommand="gvKiosk_ItemCommand"> <SortingSettings EnableSkinSortStyles="false"></SortingSettings> <GroupingSettings CaseSensitive="false" /> <MasterTableView DataKeyNames="Profile_ID" NoMasterRecordsText="There are no Kiosk records."> <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True"></PagerStyle> <Columns> <telerik:GridBoundColumn DataField="PROFILE_ID" Display="false" FilterControlAltText="Filter profileid column" HeaderText="Profile ID" UniqueName="customername"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CUSTOMERNAME" FilterControlAltText="Filter customername column" HeaderText="Customer Name" UniqueName="customername"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="EMAIL_ADDRESS" FilterControlAltText="Filter customername column" HeaderText="Email Address" UniqueName="emailaddress"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="DRIVERS_LICENSE_NO" FilterControlAltText="Filter customername column" HeaderText="DL#" UniqueName="driverslicenseno"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="BILLING_ZIP" FilterControlAltText="Filter zipcode column" HeaderText="Zip Code" UniqueName="zipcode"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn HeaderText="Details" SortExpression="Details"> <ItemTemplate> <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text="Details"></asp:HyperLink> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Details" UniqueName="DetailsColumn"> <ItemTemplate> <asp:LinkButton runat="server" ID="lnkGotoAccount" Text="Go To Account" CommandName="GoToAccount"></asp:LinkButton> | <asp:LinkButton runat="server" ID="lnkCheckIn" Text="Check In" CommandName="CheckIn" Visible="false"></asp:LinkButton> <asp:Label ID="lblProfileID" runat="server" Visible="false" Text='<%#Eval("PROFILE_ID") %>' /> <asp:Label ID="lblBillingZip" runat="server" Visible="false" Text='<%#Eval("BILLING_ZIP") %>' /> <asp:Label ID="lblSignupStep" runat="server" Visible="false" Text='<%#Eval("ACCOUNT_STATUS_DESC") %>' /> <asp:Label ID="lblPreAccountNo" runat="server" Visible="false" Text='<%#Eval("PRE_ACCOUNT_NO") %>' /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="UserName" FilterControlAltText="Filter customername column" HeaderText="Checked Out By" UniqueName="UserName"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <EditItemStyle BorderWidth="5px" /> </telerik:RadGrid> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> </div></asp:Content>
using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PAMRewrite.PAMBiz;
using Telerik.Web.UI;
namespace PAMRewrite
{
public partial class KioskList : BasePage
{
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
{
this.UpdateToolTip(args.Value, args.UpdatePanel);
}
private void UpdateToolTip(string elementID, UpdatePanel panel)
{
Control ctrl = Page.LoadControl("HoverDetail.ascx");
ctrl.ID = "ucCustomerDetails1";
panel.ContentTemplateContainer.Controls.Add(ctrl);
HoverDetail details = (HoverDetail)ctrl;
details.profileID = Convert.ToInt32(elementID);
}
protected void Page_Load(object sender, EventArgs e)
{
string CheckAuth = (string)Session["Authenticated"];
if ((CheckAuth == null) || (CheckAuth == "FALSE"))
{
Response.Redirect("Default.aspx", true);
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
else
{
// Make sure that UserType is authenticated
if ((Convert.ToInt32(Session["UserType"]) == Convert.ToInt32(cEnums.eUserType.EXTADMIN)) ||
(Convert.ToInt32(Session["UserType"]) == Convert.ToInt32(cEnums.eUserType.EXTUSER)))
{
Response.Redirect("MainMenu.aspx", false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
Session["Error"] = "FALSE";
if (!IsPostBack)
{
FillKioskListGrid();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);
}
else
{
//GridView does not keep its items' IDs after postback, so rebind it or else tooltip manager will not show tooltips
FillKioskListGrid();
}
// For Stats
if (Session["UserType"] != null)
{
if ((Int32)Session["UserType"] == Convert.ToInt32(cEnums.eUserType.SUPERADMIN) || (Int32)Session["UserType"] == Convert.ToInt32(cEnums.eUserType.INTADMIN))
{
PAMStats1.Visible = true;
RadPanelBar pnlBarStats = (RadPanelBar)PAMStats1.FindControl("pnlBarStats");
RadTabStrip tsStats = (RadTabStrip)pnlBarStats.FindItemByValue("Statistics").FindControl("RadTabstrip1");
RadTab tab1 = tsStats.Tabs.FindTabByText("CAO Statistics");
tab1.Selected = true;
}
}
}
}
//<!-- Begin Table Location Info -->
private void FillKioskListGrid()
{
KioskInformation kioskInfo = new KioskInformation();
Int32 locationCodeID = Convert.ToInt32(Session["LocationCodeID"]);
using (DataSet dsKiosks = kioskInfo.GetExistingKioskList(locationCodeID))
{
dsKiosks.Tables[0].DefaultView.Sort = "CUSTOMERNAME ASC";
gvKiosk.DataSource = dsKiosks.Tables[0].DefaultView;
gvKiosk.DataBind();
}
}
protected void gvKiosk_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem) //to access a row
{
string loginUser = Session["User"].ToString();
LinkButton lnkCheckIn = (LinkButton)e.Item.FindControl("lnkCheckIn");
DataRowView row = (DataRowView)e.Item.DataItem;
string profileID = row["PROFILE_ID"].ToString();
if (!string.IsNullOrEmpty(row["USERNAME"].ToString()))
{
LinkButton lnkGotoAccount = (LinkButton)e.Item.FindControl("lnkGotoAccount");
if (loginUser.ToUpper() == (row["USERNAME"].ToString().ToUpper()))
{
lnkCheckIn.Visible = true;
}
else
{
lnkGotoAccount.Visible = false;
}
//If Current User Type is Super Admin then Check in Button is Visiable.
if (Convert.ToInt32(Session["UserType"]) == Convert.ToInt32(cEnums.eUserType.SUPERADMIN) || Convert.ToInt32(Session["UserType"]) == Convert.ToInt32(cEnums.eUserType.INTADMIN))
{
lnkCheckIn.Visible = true;
}
}
if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
{
Control target = e.Item.FindControl("targetControl");
if (!Object.Equals(target, null))
{
if (!Object.Equals(this.RadToolTipManager1, null))
{
//Add the button (target) id to the tooltip manager
this.RadToolTipManager1.TargetControls.Add(target.ClientID, (e.Item as GridDataItem).GetDataKeyValue("Profile_ID").ToString(), true);
}
}
}
}
}
//<!-- End Table Location Info -->
protected void gvKiosk_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "GoToAccount")
{
GridDataItem item = e.Item as GridDataItem;
string domainURL = Common.GetConfigurationSetting("PAMDomainUrl");
string caoUrl = domainURL.ToString() + Common.GetConfigurationSetting("CAOLoginURL");
string emailAddress = item["emailaddress"].Text;
string dlNumber = item["driverslicenseno"].Text;
Label lblBillingZip = (Label)item.FindControl("lblBillingZip");
string billingZip = lblBillingZip.Text.ToString();
string url = caoUrl + "?email=" + emailAddress + "&dl=" + dlNumber + "&ac=" + billingZip;
string scriptstring = "openRadWin('" + url + "');";
// In order for this functionality to work you have to follow these steps. Click on the "Go To Account" link.
// You will see a window open and it should populate the username and other information automatically and log you
// into CAO. When you are finished working in CAO you MUST log out of CAO.
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "radScript", scriptstring, true);
Label lblProfileID = (Label)item.FindControl("lblProfileID");
Int32 profileID = Convert.ToInt32(lblProfileID.Text.ToString());
Int32 userID = Convert.ToInt32(Session["UserID"].ToString());
try
{
KioskInformation kioskInfo = new KioskInformation();
kioskInfo.UpdateCheckOutStatus(profileID, userID);
Label lblSignup = (Label)item.FindControl("lblSignupStep");
string status = lblSignup.Text;
if (status == "PAYMENT APPLIED TO ACCOUNT")
{
Label lblPreAcctNo = (Label)item.FindControl("lblPreAccountNo");
Session["From"] = "Kiosk"; //HARD_CODED - we are coming from Kiosk
Session["PreAccountNo"] = lblPreAcctNo.Text;
Session["ProfileID"] = profileID;
Response.Redirect("CAOAssignTags.aspx", false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
FillKioskListGrid();
HttpResponse.RemoveOutputCacheItem("/KioskList.aspx");
}
catch (Exception ex)
{
//If ReturnCode Return -990 means Needs to Refresh screen some one check out
if (!(ex.Message.Contains("-990") || ex.Message.Contains("-991")))
{
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ss", "<script>alert('The tag request is currently checked out to another user.');</script>", false);
}
else
{
ErrorLogging logging = new ErrorLogging();
logging.callingPage = Request.Url.ToString();
logging.callingMethod = System.Reflection.MethodBase.GetCurrentMethod().Name;
ErrorLogging.LogError(ex, logging);
}
}
}
else if (e.CommandName == "CheckIn")
{
GridDataItem item = e.Item as GridDataItem;
Label lblProfileID = (Label)item.FindControl("lblProfileID");
Int32 profileID = Convert.ToInt32(lblProfileID.Text.ToString());
CAOInformation.UpdateCheckInStatus(profileID);
FillKioskListGrid();
}
else if (e.CommandName == "Sort" || e.CommandName == "Page")
{
RadToolTipManager1.TargetControls.Clear();
}
}
}
}
Having setup my Autocompletebox properly and returning values, I now need to take the DataValueField and update the database when they click the update button. However in my code-behind I am unable to reference the selectedvalue.
<telerik:RadAutoCompleteBox ID="radEmailUser" runat="server" DataSourceID="SqlDataSource1" DataTextField="Contact_Email" DataValueField="EmailListID" Filter="StartsWith" InputType="Text" Width="300px" DropDownWidth="300px" TextSettings-SelectionMode="Single"> <DropDownItemTemplate> <table><tr><td> <%# DataBinder.Eval(Container.DataItem, "contact_Email")%> ( <%# DataBinder.Eval(Container.DataItem, "first_name")%> <%# DataBinder.Eval(Container.DataItem, "last_name")%>) </td></tr></table> </DropDownItemTemplate></telerik:RadAutoCompleteBox>I would like to get the value (EmailListID) that is selected and pass that onto a stored procedure for updating. Unable to properly reference the value. How can I get the value?
<asp:TableRow> <asp:TableCell HorizontalAlign="right" Text="Product"></asp:TableCell> <asp:TableCell> <table> <tr> <td> <asp:Label ID="Product" runat="server" CssClass="FieldValue"></asp:Label> </td> <td> <span id="ProductMaintenanceSpan" runat="server" style="display:none; vertical-align:middle "> <telerik:RadToolTip OnClientBeforeHide="OnClientBeforeHide" ID="ProductToolTip" HideEvent="FromCode" Position="MiddleRight" style="z-index: -1;" TargetControlID ="ProductImage" runat="server" Text="Cancelled maintenance. Requires a PO for hourly work." RelativeTo="Element"></telerik:RadToolTip> <asp:Image ID="ProductImage" ImageUrl="~/images/Info.gif" runat="server" style="cursor:pointer; vertical-align:middle" ImageAlign="TextTop"/> </span> </td> </tr> </table> </asp:TableCell></asp:TableRow>