Hi,
I used a Link button in listview itemtemplate.I need to redirect to a page in a new window.
But, I unable to find the solution.. It does not redirect to..
Thank you in advance...
I used a Link button in listview itemtemplate.I need to redirect to a page in a new window.
But, I unable to find the solution.. It does not redirect to..
My code is here...
<telerik:RadAjaxPanel ID=
"rAjaxPnlForumsCategory"
runat=
"server"
LoadingPanelID=
"rAjaxLoadingPnlForumsCategory"
>
<div style=
"border-top:1px solid #828282; border-bottom:1px solid #828282;"
>
<telerik:RadListView ID=
"rlstviewReply"
runat=
"server"
Width=
"100%"
DataKeyNames=
"ForumPostReplyID"
OnNeedDataSource=
"rlstviewReply_NeedDataSource"
OnItemDataBound=
"rlstviewReply_ItemDataBound"
>
<ItemTemplate >
<table width=
"100%"
>
<tr>
<td>
Replied by
<asp:LinkButton ID=
"lnkbtnCandidateName"
runat=
"server"
OnCommand=
"lnkbtnCandidateName_Command"
Enabled=
"false"
CssClass=
"_TextBoldSubCategory"
></asp:LinkButton>
<span> On <asp:Label ID=
"lblCreatedOn"
runat=
"server"
Text=
""
></asp:Label></span>
</td>
</tr>
<tr>
<td>
<div id=
"divReply"
runat=
"server"
class
=
"_PaddingTop5 _PaddingBottom5"
><%# Eval(
"Reply"
) %></div>
</td>
</tr><tr><td id=
"Td1"
runat=
"server"
visible=
'<%# (Container.DataItemIndex + 1).ToString() != hidCount.Value %>'
align=
"center"
class
=
"DottedLineBottom2"
style=
"text-align:center;"
></td></tr>
</table>
</ItemTemplate>
</telerik:RadListView>
</div>
<div
class
=
"_PaddingTop20"
>
Post your reply
<div
class
=
"_PaddingTop20"
>
<telerik:RadEditor runat=
"server"
Skin=
"Telerik"
ToolsFile=
"~/Forums/RadEditorTools.xml"
ContentAreaCssFile=
"~/Styles/Editorstyle.css"
ID=
"radeditorReply"
Width=
"100%"
>
</telerik:RadEditor>
<asp:RequiredFieldValidator CssClass=
"ErrorMessage"
ID=
"RequiredFieldValidator1"
runat=
"server"
ErrorMessage=
"*"
ControlToValidate=
"radeditorReply"
ValidationGroup=
"reply"
></asp:RequiredFieldValidator>
</div>
</div>
<div
class
=
"_PaddingTop5"
style=
"text-align :center;"
>
<telerik:RadButton ID=
"btnSubmit"
runat=
"server"
Text=
"SUBMIT"
onclick=
"btnSubmit_Click"
ValidationGroup=
"reply"
>
</telerik:RadButton>
</div>
<div> </div>
</telerik:RadAjaxPanel>
<asp:HiddenField ID=
"hidCount"
runat=
"server"
/>
protected
void
rlstviewReply_ItemDataBound(
object
sender, Telerik.Web.UI.RadListViewItemEventArgs e)
{
try
{
if
(!(e.Item
is
RadListViewDataItem))
{
return
;
}
if
(e.Item
is
RadListViewItem)
{
RadListViewDataItem rlvItem = (RadListViewDataItem)e.Item;
LinkButton lnkbtnCandidateName = (LinkButton)rlvItem.FindControl(
"lnkbtnCandidateName"
);
Label lblCreatedOn = (Label)rlvItem.FindControl(
"lblCreatedOn"
);
ForumPostReplies forumpostsreply = (ForumPostReplies)rlvItem.DataItem;
if
(forumpostsreply ==
null
)
{
return
;
}
lnkbtnCandidateName.Text =
string
.Format(
"{0}"
, forumpostsreply.Users.UserName);
lblCreatedOn.Text = forumpostsreply.CreatedOn.ToString(
"g"
);
if
(SessionHandler.User.UserTypeID == (
int
)FrameworkConstants.USER_TYPE.Employer)
{
lnkbtnCandidateName.Enabled =
true
;
lnkbtnCandidateName.CommandArgument = forumpostsreply.Users.UserID.ToString();
lnkbtnCandidateName.Attributes.Add(
"OnClick"
,
" window.location.href ="
+ FrameworkConstants.PROJECT_PAGES.CANDIDATE_PROFILE.Description() +
");"
);
}
}
}
catch
(Exception ex)
{
ErrorLogging.AddErrorLog(ex);
}
}
protected
void
lnkbtnCandidateName_Command(
object
sender, CommandEventArgs e)
{
try
{
if
(e.CommandArgument ==
null
)
{
return
;
}
long
userID = 0;
if
(
long
.TryParse(e.CommandArgument.ToString(),
out
userID))
{
Session[FrameworkConstants.SESSION_VARIABLES.CANDIDATEID.ToString()] = userID;
}
}
catch
(Exception ex)
{
ErrorLogging.AddErrorLog(ex);
}
}
Thank you in advance...