I am working on a page which has a form on it with some fields, a save and a cancel button.
There is also a user control (.ascx) which has a text field and an "Add comment" button..
The thing is I have now been asked to add some new features, one of which is to get the save button (on the main page) to add comments as well as save. (currently the add comments button must be clicked and then the save button (as save ignores the comments)).
I have set it so that the main page can see the add comments method on the user control, but it gives an unhandled overload '0' error.
here are some snippets of code:
----------------------------------------------------------
from ascx file: comments.ascx
<script runat="server"> //there is more in here but it is not relevant
public void AddComment(Object s, EventArgs e) {
if (Page.IsValid) {
string textExists = txtComment.Text;
if (textExists !="") {
IssueComment comment = new IssueComment(IssueId, txtComment.Text.Trim(), Page.User.Identity.Name);
comment.Save();
txtComment.Text = String.Empty;
BindComments();
}
}
}
</script>
<asp:TextBox id="txtComment" TextMode="MultiLine" Columns="75" Rows="5" runat="Server" />
<asp:Button id="btnAdd" Text="Add Comment" OnClick="AddComment" CssClass="standardText" Runat="Server" />
---------------------------------------------
from aspx file: Save.aspx
<%@ Register TagPrefix="it" TagName="Comments" Src="~/issues/UserControls/Comments.ascx" %>
<script runat="server">//again some code is left out as not neccessary
void btnSaveClick(Object s, EventArgs e) {
if (Page.IsValid){
ctlComment.AddComment();
SaveIssue();
}
}
</script>
<form runat="server" enctype="multipart/form-data">
<asp:button id="btnSave" runat="server" width="53px" CssClass="standardText" Text="Save" OnClick="btnSaveClick"></asp:button>
<asp:TextBox id="txtTitle" Columns="50" Runat="Server" />
<asp:RequiredFieldValidator ControlToValidate="txtTitle" Text="(required)" runat="Server" />
<it:Comments id="ctlComment" Visible="false" runat="Server" />
</form>
If anyone can help me out that would be great as this needs to be sorted out fairly urgently.
Many Thanks
Hygor