I need to change the text of NextButton using RadWizard - c#

I'm trying to change the text of next button in radwizard from the code behind, can some one please help me?
I have four steps and I want to be able to change the text of the button next when I'm in a specific step of the wizard, is this possible
<telerik:RadWizard ID="rwzPurchase" runat="server" Height="510px" Width="100%" DisplayProgressBar="false" OnNextButtonClick="rwzPurchase_NextButtonClick1" DisplayNavigationButtons="true" DisplayCancelButton="true">
<WizardSteps>
<%-- Confirmation --%>
<telerik:RadWizardStep Title="Confirmation">
<div class="row-fluid">
<div class="control-group-header margin-bottom-10">
<asp:label class="label-greentheme label label-inline-border" ID="LBTitle" runat="server">RP Specific Options</asp:label><br />
</div>
<br />
</div>
<div style="text-align:left">
<asp:Label ID="LBMessage" runat="server" Font-Size="Large" CssClass="message" />
</div>
</telerik:RadWizardStep>
<%-- Grower Information --%>
<telerik:RadWizardStep Title="Grower Information">
<uc1:GrowerInfo runat="server" ID="GrowerInfo" />
</telerik:RadWizardStep>
<%-- E-Signature --%>
<telerik:RadWizardStep Title="E-Signature">
<uc1:eSigControl runat="server" ID="eSigControl" />
</telerik:RadWizardStep>
<%-- Finish --%>
<telerik:RadWizardStep Title="Finish">
<div class="container">
<div class="row-fluid">
<div class="control-group-header margin-bottom-10">
<asp:Label class="label-greentheme label label-inline-border" ID="LBSuccessTitle" runat="server" /><br />
</div>
<br />
<asp:Label ID="LBSuccessText" runat="server" Font-Size="Large"/>
</div>
</div>
</telerik:RadWizardStep>
</WizardSteps>
</telerik:RadWizard>
c#
protected void rwzPurchase_NextButtonClick1(object sender, WizardEventArgs e)
{
if (rwzPurchase.ActiveStep.Title == "Grower Information")
{
//Here is where I want to change the text of button if we are in this specific step
RadButton button = (RadButton)sender;
button.Text = "test";
this.rwzPurchase.CommandArea.CommandElements.Add(button);
}
}

Related

ModalPopupExtender hides when dropdown post back works

I have a model pop up extender, within this pop up i have a dropdown list with AutopostBack="True". Now when I select one dropdown value the ModalPopupExtender hides. Let me know the reason??? Someone preferred to put update panel but still the problem exists
My pop up controls is,
<cc1:ToolkitScriptManager runat="server" ID="ToolkitScriptManager1" EnableScriptGlobalization="true"></cc1:ToolkitScriptManager>
<asp:HiddenField ID="HiddenField1" runat="server" />
<cc1:ModalPopupExtender ID="ModalPopupExtender3" runat="server"
BehaviorID="modalPopupExtender3"
TargetControlID="HiddenField1"
OkControlID="cancel1"
BackgroundCssClass="modalPopup" >
</cc1:ModalPopupExtender>
<!-- Update section-->
<div id="updatdediv1" visible="false" >
<div class="portlet box blue" id="Div3">
<div class="portlet-title">
<div class="caption"><i class="icon-reorder"></i> Add Salary Component </div>
<div class="tools">
<asp:imagebutton ID="Imagebutton2" runat="server" class="close" ImageUrl="~/jimage/clossse.PNG" />
</div>
</div>
<div class="portlet-bodypop">
<div class="controls">
<label class="control-label">Pay Grade:</label>
<asp:DropDownList ID="ddpaygrade" runat="server" AutoPostBack="true" class="m-wrap large" AppendDataBoundItems="false" ></asp:DropDownList>
</div>
<div class="controls">
<label class="control-label">DA %:</label>
<asp:TextBox ID="txtda" runat="server" class="m-wrap large" ReadOnly="true"></asp:TextBox>
</div>
<div class="controls">
<label class="control-label">Basic:</label>
<asp:TextBox ID="txtbasic" runat="server" class="m-wrap large"></asp:TextBox>
</div>
<div class="controls">
<label class="control-label">Calculated DA:</label>
<asp:TextBox ID="txtcalculatedDA" class="m-wrap large" runat="server" ></asp:TextBox>
</div>
<div class="form-actions1">
<button id="Button2"onclick="myFunction()"" style="display:none" >Save</button>
<asp:Button ID="btnedit2" runat="server" Text="Submit" CssClass="btn blue" ValidationGroup="grp1" />
<asp:Button ID="btncancel3" runat="server" Text="Cancel" CssClass="btn"/>
<asp:Label ID="label1" runat="server" Text="" Visible="false"></asp:Label>
</div>
</div>
</div>
</div>
<!-- temp panel-->
<asp:Panel ID="kj" runat="server" >
<table >
<tr><td class="style9">
<table >
<tr> <td class="style8"> </td> </tr>
<tr >
<td align="left" class="style12">
<asp:Button ID="cancel1" runat="server" Text="Cancel" Style=" display:none"
</td>
</tr>
</table>
</td></tr></table>
</asp:Panel>
If you need the modal popup extender to "survive" the postback, then you will have to manage that yourself. Handle the dropdown's SelectedIndexChanged event and show the popup there:
protected void ddpaygrade_SelectedIndexChanged(object sender, EventArgs e)
{
ModalPopupExtender3.Show();
}
Don't forget to wire-up the event in your markup:
<asp:DropDownList ID="ddpaygrade" runat="server" AutoPostBack="true"
class="m-wrap large" AppendDataBoundItems="false"
OnSelectedIndexChanged="ddpaygrade_SelectedIndexChanged" >
</asp:DropDownList>

Printing data upon saving

I am using asp.net(C#) web forms. I have complaints.aspx page which takes several inputs from users and then saves them upon clicking SAVE button. It's working perfectly but now I am stuck with one problem, I want to make a printout of the submitted record upon clicking the save button. It should be printed from the local printer but I couldn't find any solutions for it.
.aspx code:
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="frmStaffMembers.aspx.cs" Inherits="frmStaffMembers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
$(document).ready(function () {
$("#btnUpdate").hide();
$("#btnDelete").hide();
$("#btnCancel").hide();
$("#lblSelectedID-Span").hide();
$("#txtSelectedID-Span").hide();
var showHide = $("#HiddenFieldShowHideButtons").val();
if (showHide == "True") {
$("#btnUpdate").show();
$("#btnDelete").show();
$("#btnCancel").show();
$("#lblSelectedID-Span").show();
$("#txtSelectedID-Span").show();
$("#buttonSearch").hide();
$("#Save-Span").hide();
$("#HiddenFieldShowHideButtons").val("False");
}
$("#btnUpdate").click(function () {
$("#ConfirmMsg").text("Are you sure to update this record?");
$("#Delete-Span").hide();
$("#lblSelectedID-Span").hide();
$("#txtSelectedID-Span").hide();
$("#Save-Span").show();
$("#buttonSearch").show();
$("#Update-Span").show();
$("#btnUpdate").hide();
$("#btnDelete").hide();
$("#btnCancel").hide();
$("#ModalConfirmAction").modal({ show: true })
});
$("#btnDelete").click(function () {
$("#ConfirmMsg").text("Are you sure to delete this record?");
$("#Update-Span").hide();
$("#lblSelectedID-Span").hide();
$("#txtSelectedID-Span").hide();
$("#Delete-Span").show();
$("#Save-Span").show();
$("#buttonSearch").show();
$("#btnDelete").hide();
$("#btnUpdate").hide();
$("#btnCancel").hide();
$("#ModalConfirmAction").modal({ show: true })
});
$("#btnCancel").click(function () {
$("#btnUpdate").hide();
$("#btnDelete").hide();
$("#btnCancel").hide();
$("#lblSelectedID-Span").hide();
$("#txtSelectedID-Span").hide();
$("#buttonSearch").show();
$("#Save-Span").show();
ClearTextBoxes();
});
});
function ClearTextBoxes() {
$("input[type=text]").each(function () {
$(this).val("");
});
}
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div class="widget">
<div class="widget-header">
<div class="title">
Staff Members
<span id="sectionDetails" class="mini-title" runat="server"> Enter/Edit record </span>
</div> <!-- widget title-->
</div> <!-- widget header -->
<div class="widget-body">
<div class="row-fluid">
<!-- cons start -->
<div class="shortcut-group">
<asp:HiddenField ID="HiddenFieldSetMessage" runat="server"
ClientIDMode="Static"/>
<asp:HiddenField ID="HiddenFieldShowMessage" runat="server"
ClientIDMode="Static"/>
<asp:HiddenField ID="HiddenFieldShowHideButtons" runat="server"
ClientIDMode="Static" />
<span id="lblSelectedID-Span"><label id="lblSelectedID" runat="server">Selected ID</label></span>
<span id="txtSelectedID-Span"><asp:TextBox ID="txtSelectedID" runat="server" ReadOnly="True"
CssClass="textField_width"></asp:TextBox></span>
<label>Member Name</label>
<asp:TextBox ID="txtMemberName" runat="server" ValidationGroup="GroupCompanies"
CssClass="textField_width"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtMemberName" ErrorMessage="Member Name is Required"
ForeColor="Red" ValidationGroup="grpValidationTextboxes">Member Name is Required
</asp:RequiredFieldValidator>
<br />
<label>Member CNIC</label>
<asp:TextBox ID="txtMemberCNIC" runat="server" CssClass="textField_width"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtMemberCNIC" ErrorMessage="Member CNIC is Required"
ForeColor="Red" ValidationGroup="grpValidationTextboxes">Member CNIC is Required
</asp:RequiredFieldValidator>
<br />
<label>ContactNo</label>
<asp:TextBox ID="txtContactNo" runat="server" CssClass="textField_width"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txtContactNo" ErrorMessage="Contact No is Required"
ForeColor="Red" ValidationGroup="grpValidationTextboxes">Conatact No is Required
</asp:RequiredFieldValidator>
<br />
<label>Head's Designation</label>
<asp:DropDownList ID="ddlHeadDesignations" runat="server" width="220px">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="ddlHeadDesignations" InitialValue="0" ErrorMessage="Selection is Required"
ForeColor="Red" ValidationGroup="grpValidationTextboxes">Selection is Required
</asp:RequiredFieldValidator>
<br />
<label>Is Morning?</label>
<asp:DropDownList ID="ddlMorningEvening" runat="server" width="220px">
<asp:ListItem Value="-1" Text="-Select-"></asp:ListItem>
<asp:ListItem Value="1" Text="Yes"></asp:ListItem>
<asp:ListItem Value="0" Text="No"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="ddlMorningEvening" InitialValue="-1" ErrorMessage="Selection is Required"
ForeColor="Red" ValidationGroup="grpValidationTextboxes">Selection is Required
</asp:RequiredFieldValidator>
<br />
<br/>
<span id="Save-Span">
<asp:Button ID="btnSave" CssClass="btn btn-success" runat="server" Text="Save"
onclick="btnSave_Click" ValidationGroup="grpValidationTextboxes" ClientIDMode="Static" />
</span>
<input type="button" id="btnUpdate" class="btn btn-success" value="Update"/>&nbsp
<input type="button" id="btnDelete" class="btn btn-danger" value="Delete"/>&nbsp
<input type="button" id="btnCancel" class="btn btn-success" value="Cancel" />
Search Records
</div> <!-- shourtcut group">
<!-- cons end -->
</div> <!-- row fluid -->
</div> <!-- widget body-->
</div> <!-- widget-->
<div class="clearfix"></div>
<!-- Modal -->
<div id="myModal" style="width:700px important;" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Search Records</h3>
</div>
<div class="modal-body">
<p>Please enter staff member's name to search relevant record/Press search button with empty field to view all records</p>
<label>Staff Member</label>
<asp:TextBox ID="txtStaffMemberNamePopUp" runat="server"></asp:TextBox>
<asp:Button ID="btnSearchPopup" CssClass="btn btn-success pad_mar" runat="server" Text="Search"
onclick="btnSearchPopup_Click" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSearchPopup" EventName = "Click"/>
<asp:AsyncPostBackTrigger ControlID = "gridviewStaffMembers" EventName="PageIndexChanging" />
<asp:AsyncPostBackTrigger ControlID="gridviewStaffMembers"
EventName="SelectedIndexChanging" />
</Triggers>
<ContentTemplate>
<asp:Label ID="lblMsgPopUp" runat="server"
Text="No records found for the specified criteria" Visible="False"
ForeColor="Red"></asp:Label>
<asp:GridView ID="gridviewStaffMembers" CellPadding="20" runat="server"
AutoGenerateSelectButton="True" Visible="False"
GridLines="None"
AllowPaging="True"
CssClass="mGrid"
PagerStyle-CssClass="pgr"
AlternatingRowStyle-CssClass="alt"
OnPageIndexChanging="gridviewStaffMembers_PageIndexChanging" >
<AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
<FooterStyle BorderWidth="0px" />
<PagerStyle CssClass="pgr"></PagerStyle>
<RowStyle BorderWidth="0px" CssClass="row" Wrap="True" />
<SelectedRowStyle CssClass="selected-row" ForeColor="White" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:Button ID="btnClose" runat="server" Text="Close" CssClass="btn btn-success" data-dismiss="modal" aria-hidden="true" />
<asp:Button ID="btnEdit" CssClass="btn btn-success" runat="server" Text="Edit" onclick="btnEdit_Click"/>
</div>
</div>
<!-- this is confirmation modal-->
<div id="ModalConfirmAction" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="H1">Confirmation</h3>
</div>
<div class="modal-body">
<p id="ConfirmMsg"></p>
</div>
<div class="modal-footer">
<span id="Delete-Span">
<asp:Button ID="btnDeletePopUp" CssClass="btn btn-danger" runat="server"
Text="Delete" onclick="btnDeletePopUp_Click" />
</span>
<span id="Update-Span">
<asp:Button ID="btnUpdatePopUp" CssClass="btn btn-success" runat="server" Text="Update"
onclick="btnUpdatePopUp_Click" />
</span>
<asp:Button ID="btnClosePopup" runat="server" Text="Cancel"
CssClass="btn btn-success" onclick="btnClosePopup_Click"/>
</div>
</div>
</asp:Content>
.cs code:
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
short HeadDesignationID = Convert.ToInt16(ddlHeadDesignations.SelectedValue);
short IsMorning = Convert.ToInt16(ddlMorningEvening.SelectedValue);
StaffMembersBizz StaffMembersBizz = new StaffMembersBizz(txtMemberName.Text, txtMemberCNIC.Text,
txtContactNo.Text, HeadDesignationID, IsMorning);
ManageStaffMembers mngStaffMembers = new ManageStaffMembers();
bool Result = mngStaffMembers.Insert(StaffMembersBizz);
if (Result == true)
{
HiddenFieldSetMessage.Value = "Saved";
HiddenFieldShowMessage.Value = "True";
Clear(txtMemberName, txtMemberCNIC, txtContactNo);
}
else
{
HiddenFieldSetMessage.Value = "RecordAlreadyExists";
HiddenFieldShowMessage.Value = "True";
}
}
catch (Exception)
{
HiddenFieldSetMessage.Value = "NotSaved";
HiddenFieldShowMessage.Value = "True";
}
}
I assume after you save, there is some sort of confirm page?
If so in your Save event, you could add the following code which will bring up the print prompt for the confirmation page automatically. You can't make the client print on your own because that is controlled on their end but you can make the print dialog appear.
Add this server side code to the end of you Save event:
ClientScript.RegisterStartupScript(this.GetType(), "FormLoading", "window.print();", true);
Make sure that page that is served up has the print data that you need and is formatted correctly. You can customize the css to apply a print only style as well.

Asp .Net UpdatePanel not working

I am using an UpdatePanel to show some controls that are normally hidden.
This is the code that I am using:
<asp:LinkButton runat="server" class="btn blue h27" CausesValidation="false" ID="lnkSuggestArticle"
OnClick="lnkSuggestArticle_Click"><%=Supplier.GetResource("Answers_lnkSuggestArticle")%> <i class="icon icon_next_02 fr"></i></asp:LinkButton>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<div class="infoRequest" id="divSuggestion" runat="server" visible="false">
<br class="clearfix" />
<h3>
Please provide the information you want to see on our support site:</h3>
<br class="clearfix" />
<asp:TextBox runat="server" ID="txtSuggestArticle" Rows="10" ValidationGroup="s" Width="100%"
TextMode="MultiLine"></asp:TextBox>
<div id="divEmailAddress" runat="server" visible="false">
<br />
<h3>
Please enter your email address</h3>
<asp:TextBox runat="server" ID="txtEmailAddress" Rows="1" ValidationGroup="s" CssClass="suggestionEmail"
TextMode="SingleLine"></asp:TextBox>
<br />
</div>
<br />
<asp:Label runat="server" ID="lblSugestedArticleError" ForeColor="Red" Visible="false"></asp:Label>
<asp:Label runat="server" ID="lblMessage" ForeColor="Red"></asp:Label>
<br />
<asp:LinkButton ID="btnSaveSuggestion" ValidationGroup="s" runat="server" OnClick="btnSaveSuggestion_Click"
CssClass="btn blue fr"><%=Supplier.GetResource("createticket_btnSuggest")%> <i class="icon icon_next_02 fr"></i></asp:LinkButton>
<%--<input type="submit" value="Suggest" class="btnSuggest" />--%>
<br />
<br />
<p id="notice" runat="server">
<asp:Label runat="server" ID="lblSuggestionNote" /></p>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lnkSuggestArticle" />
</Triggers>
</asp:UpdatePanel>
When the user clicks the lnkSuggestArticle button I execute the following code:
protected void lnkSuggestArticle_Click(object sender, EventArgs e)
{
divSuggestion.Visible = true;
if ((WFSS.DataAccess.Entities.Customer)Session["__currentCustomer"] == null)
{
divEmailAddress.Visible = true;
}
}
But it doesn't update the page. The div still stays hidden when the user clicks the suggest button.
protected void lnkSuggestArticle_Click(object sender, EventArgs e)
{
divSuggestion.Visible = true;
if (Session["__currentCustomer"] == null)
{
divEmailAddress.Visible = true;
}
}
It turns out that there was a bug in Visual Studio. I had commented a piece of code in the aspx file. Turns out even though it appeared to be commented the code still executed which caused another update panel to be added which gave me an error in javascript.

trying to dynamic asp:FileUpload , refresh trouble

i need the users of my web system to do uploads ( up 4 ).
the upload itself its working , but i dont want all for box appering at start, so tried to hide the 2nd ,3rd and 4th upload boxes until the user need them .
here the aspx code part
<fieldset>
<div class="frm tam">
</div>
<div class="lin">
<asp:FileUpload ID="FileUpload1" runat="server" /></div>
<div class="lin">
<asp:FileUpload ID="FileUpload2" runat="server" Visible="false" /></div>
<div class="lin">
<asp:FileUpload ID="FileUpload3" runat="server" Visible="false" /></div>
<div class="lin">
<asp:FileUpload ID="FileUpload4" runat="server" Visible="false" /></div>
<div class="lin">
<asp:Button ID="btnUpload" runat="server" Text="Upload"OnClick="btnUpload_Click" />
<asp:Button ID="btnAdd" runat="server" Text="ADD File" OnClick="btnAdd_Click" />
<asp:Button ID="btnRem" runat="server" Text="Remove File" OnClick="btnRem_Click" />
</div>
</fieldset>
and the code behind to show and hide the boxes
protected void btnAdd_Click(object sender, EventArgs e)
{
if (FileUpload2.Visible == false)
{
FileUpload2.Visible = true;
}
else if (FileUpload3.Visible == false)
{
FileUpload3.Visible = true;
}
else if (FileUpload4.Visible == false)
{
FileUpload4.Visible = true;
}
}
protected void btnRem_Click(object sender, EventArgs e)
{
if (FileUpload4.Visible == true)
{
FileUpload4.Visible = false;
}
else if (FileUpload3.Visible == true)
{
FileUpload3.Visible = false;
}
else if (FileUpload2.Visible == true)
{
FileUpload2.Visible = false;
}
}
and when i click on Add File, the new box appear but the filepaths selected on the other boxes are cleared. Can i avoid this clear ?
*edit: i´m using net framework 4.0 .
The file get lost on postback. Alternatively, you can achieve that with JavaScript
<div id="div1">
<asp:FileUpload ID="FileUpload1" runat="server" />
</div>
<div id="div2" style="display:none"> <!-- visibility:hidden -->
<asp:FileUpload ID="FileUpload2" runat="server" />
</div>
<div id="div3" style="display:none">
<asp:FileUpload ID="FileUpload3" runat="server" />
</div>
<div id="div4" style="display:none">
<asp:FileUpload ID="FileUpload4" runat="server" />
</div>
Then put each FileUpload control in each of the divs.
<input type="button" valud="Add" onclick="addControls()" />
Then use JavaScript to make them visible
function addControls()
{
document.getElementById('div2').style.display = 'inline-block';
//$('#div2').show(); <--- JQuery
}
The problem here is that uploading files works slightly differently to most input controls...
Rather than posting the file path value that is entered, it actually posts the file content so
on postback this value gets lost.
It seems to me like your best bet is to do something with javascript on the client to show/hide these upload controls. This would also be a better user experience as the user wouldn't have to wait for postback each time.
You could do this with jQuery...
http://jsfiddle.net/BAwfH/2/
<fieldset>
<div class="frm tam">
</div>
<div class="lin">
<asp:FileUpload ID="FileUpload1" runat="server" />
</div>
<div class="lin">
<asp:FileUpload ID="FileUpload2" runat="server" />
</div>
<div class="lin">
<asp:FileUpload ID="FileUpload3" runat="server" />
</div>
<div class="lin">
<asp:FileUpload ID="FileUpload4" runat="server" />
</div>
<div>
<asp:Button ID="btnUpload" runat="server" Text="Upload"OnClick="btnUpload_Click" />
<asp:Button ID="btnAdd" class="add-button" runat="server" Text="ADD File" OnClick="btnAdd_Click" />
<asp:Button ID="btnRem" runat="server" Text="Remove File" OnClick="btnRem_Click" />
</div>
<script type="text/javascript">
$(document).ready(function(){
var lines = $('.lin');
lines.hide();
lines.filter(':first').show();
$('.add-button').click(function(){
lines.filter(':hidden:first').show();
if(lines.filter(':hidden').length == 0)
$(this).hide();
});
});

Membership profiles in repeater

Frontend
<asp:Repeater ID="rpt_comments" runat="server" DataSourceID="sqldata_rpt_comments" OnLoad="rpt_comments_Load">
<ItemTemplate>
<div class="comments">
<div class="news-comment-left">
<asp:Image ID="imgCommentAvatar" Width="50px" Height="50px" runat="server" />
</div>
<div class="news-comment-right">
<asp:Label ID="lblCommentProfile" runat="server"></asp:Label>
<asp:Label ID="lblCommentAuthor" runat="server" Text='<%#Eval ("CommentsAuthor") %>' Visible="false"></asp:Label>
<div style="float: right;"><%#Eval ("CommentsDate", "{0:dd.MM.yyyy}") %></div>
<br />
<%#Eval ("Comment") %><br />
</div>
<br />
<br />
<br />
<br />
</div>
</ItemTemplate>
</asp:Repeater>
Backend
public void commentsprofiles()
{
Label CommentAuthor = (Label)Tools.FindControlRecursive(rpt_comments, "lblCommentAuthor");
Label CommentProfile = (Label)Tools.FindControlRecursive(rpt_comments, "lblCommentProfile");
Image imgCommentAvatar = (Image)Tools.FindControlRecursive(rpt_comments, "imgCommentAvatar");
ProfileCommon userProfile = Profile.GetProfile(CommentAuthor.Text);
imgCommentAvatar.ImageUrl = userProfile.Avatar;
CommentProfile.Text = userProfile.NickName;
}
protected void rpt_comments_Load(object sender, EventArgs e)
{
commentsprofiles();
}
As you can see I'm trying to retrieve the controls in my repeater by using FindControlRecursive and when I've extracted the controls and want to tell whats in them I get the profiles in asp.net Membership and it also works but only for the 1 repeating item in my repeater so I need help how to code so it keeps repeating the profiles for each CommentAuthor there is.
Use the Repeater.ItemDataBound Event
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.itemdatabound.aspx

Categories