📄 faqs.ascx.cs
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI.WebControls;
using Rainbow.UI;
using Rainbow.UI.WebControls;
namespace Rainbow.DesktopModules
{
/// <summary>
/// IBS Portal FAQ module
/// (c)2002 by Christopher S Judd, CDP & Horizons, LLC
/// Moved into Rainbow by Jakob Hansen, hansen3000@hotmail.com
/// </summary>
public abstract class FAQs : PortalModuleControl
{
protected System.Web.UI.WebControls.DataList myDataList;
/// <summary>
/// The Page_Load event on this page calls the BindData() method
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Page_Load(object sender, System.EventArgs e)
{
BindData();
}
/// <summary>
/// The myDataList_ItemCommand function is used to
/// determine the FAQ the user selected in the form
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void myDataList_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
{
// hide answer if shown, show answer if hidden
if (myDataList.SelectedIndex == e.Item.ItemIndex)
myDataList.SelectedIndex = -1;
else
myDataList.SelectedIndex = e.Item.ItemIndex;
BindData();
}
/// <summary>
/// The Binddata method on this User Control is used to
/// obtain a DataReader of event information from the FAQ
/// table, and then databind the results to a templated DataList
/// server control. It uses the Rainbow.FAGsDB()
/// data component to encapsulate all data functionality.
/// </summary>
private void BindData()
{
FAQsDB questions = new FAQsDB();
myDataList.DataSource = questions.GetFAQ(ModuleId);
myDataList.DataBind();
}
public override Guid GuidID
{
get
{
return new Guid("{2502DB18-B580-4F90-8CB4-C15E6E531000}");
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.myDataList.ItemCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.myDataList_ItemCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -