using
System;
using
System.Data;
using
System.Data.SqlClient;
using
System.Text;
using
System.Web.UI;
using
System.Web.UI.WebControls;
{
/// -----------------------------------------------------------------------------
///
/// The ViewReadmore class displays the content
///
/// -----------------------------------------------------------------------------
public
partial
class
View : ReadmoreModuleBase, IActionable
{
#region Event Handlers
override
protected
void
OnInit(EventArgs e)
{
InitializeComponent();
base
.OnInit(e);
}
private
void
InitializeComponent()
{
this
.Load +=
new
System.EventHandler(
this
.Page_Load);
}
/// -----------------------------------------------------------------------------
///
/// Page_Load runs when the control is loaded
///
/// -----------------------------------------------------------------------------
private
void
Page_Load(
object
sender, System.EventArgs e)
{
try
{
}
catch
(Exception exc)
//Module failed to load
{
Exceptions.ProcessModuleLoadException(
this
, exc);
}
if
(!Page.IsPostBack)
{
DataSet ds =
new
DataSet();
DataTable dt =
new
DataTable();
dt.Columns.Add(
"BookName"
,
typeof
(
string
));
dt.Columns.Add(
"Author"
,
typeof
(
string
));
dt.Columns.Add(
"Publisher"
,
typeof
(
string
));
dt.Columns.Add(
"Description"
,
typeof
(
string
));
ds.Tables.Add(dt);
dt.Rows.Add(
new
object
[] {
"programing in java"
,
"Herbert"
,
"BPB"
,
"Learn core java by steps and more about advance java programing "
});
dt.Rows.Add(
new
object
[] {
"C++ programing"
,
"Bala Gurswamy"
,
"Macmillan"
,
"C++ programing with easy steps ANSI C++ Networking with Windows Server 2008 , Managing routers , switches Networking with Red hat Linux "
});
grdbookdetail.DataSource = ds;
grdbookdetail.DataBind();
}
}
#endregion
#region Optional Interfaces
public
ModuleActionCollection ModuleActions
{
get
{
ModuleActionCollection Actions =
new
ModuleActionCollection();
Actions.Add(GetNextActionID(), Localization.GetString(
"EditModule"
,
this
.LocalResourceFile),
""
,
""
,
""
, EditUrl(),
false
, SecurityAccessLevel.Edit,
true
,
false
);
return
Actions;
}
}
#endregion
public
string
Limit(
object
Desc,
int
length)
{
StringBuilder strDesc =
new
StringBuilder();
strDesc.Insert(0, Desc.ToString());
if
(strDesc.Length > length)
return
strDesc.ToString().Substring(0, length) +
"..."
;
else
return
strDesc.ToString();
}
protected
void
ReadMoreLinkButton_Click(
object
sender, EventArgs e)
{
// System.Threading.Thread.Sleep(3000);
LinkButton button = (LinkButton)sender;
GridViewRow row = button.NamingContainer
as
GridViewRow;
Label descLabel = row.FindControl(
"lblDescription"
)
as
Label;
button.Text = (button.Text ==
"Read More"
) ?
"Hide"
:
"Read More"
;
string
temp = descLabel.Text;
descLabel.Text = descLabel.ToolTip;
descLabel.ToolTip = temp;
}
}
}