Welcome Guest Search | Active Topics | Sign In | Register

Using Dialog for editing Options
James
Posted: Wednesday, September 30, 2009 3:18:55 PM
Rank: Member
Groups: Member

Joined: 10/4/2008
Posts: 28
Hello, I want to use a form in an eo:dialog for some simple editing with textboxes. When the user clicks OK I need to save the new textbox values to my database. Do you have an example of this?

I am currently using a form in an aspx page and everything works fine except the textbox values have not changed in the btnOkay_Click handler after I make changes on the form and click the OK button.

aspx code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CellDetail.aspx.cs" Inherits="TimeSheet.CellDetail" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function onSuccess()
{
eo_GetObject("Dialog1").close();
window.parent.document.getElementById('LinkButton1').click();
}
</script>
</head>
<body style="margin: 0px; padding: 0px;">
<form id="form1" runat="server">
<input type="hidden" value="" runat="server" id="hdnWindowUIMODE" />
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div class="popup_Container">
<div class="popup_Titlebar" id="PopupHeader">
<div class="TitlebarLeft">
</div>
<div class="TitlebarRight" onclick="cancel();">
</div>
</div>
<div class="popup_Body">
<table>
<tr>
<td>
Hours:
</td>
<td>
<asp:TextBox ID="TextBoxCategory" runat="server" Width="70px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Description:</td>
<td>
<asp:TextBox ID="TextBoxDescription" runat="server" Height="65px" TextMode="MultiLine"
Width="300px"></asp:TextBox>
</td>
</tr>
</table>
</div>
<div class="popup_Buttons">
<asp:Button ID="btnOkay" Text="Done" runat="server" OnClick="btnOkay_Click" />
<input id="btnCancel" value="Cancel" type="button" onclick="cancel();" />
</div>
</div>
</form>
</body>
</html>

code behind

protected void Page_Load(object sender, EventArgs e)
{
//Response.Cache.SetCacheability(HttpCacheability.NoCache);
LoadDetails();
}

private void LoadDetails()
{
int EntryLogID = Util.Convert2iUndefinedIfNotInt((Session["ENTRYID"]).ToString());

if (EntryLogID == Util.iUndefinedInt)
ELBO = new TT_EntryLogBO();
else
{
ELBO = new TT_EntryLogBO(EntryLogID);
ELBO.Get();
}
TextBoxCategory.Text = ELBO.Duration.ToString();
TextBoxDescription.Text = ELBO.Description;
}
protected void btnOkay_Click(object sender, EventArgs e)
{
ELBO.Duration = Util.Convert2dUndefinedIfDBNull(TextBoxCategory.Text);
ELBO.Description = TextBoxDescription.Text;
ELBO.Save();

ClientScript.RegisterStartupScript(this.GetType(), "onload", "onSuccess();", true);
}


eo_support
Posted: Wednesday, September 30, 2009 5:40:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You would simply change TextBox1.Text to Editor1.Html in your code. Everything else should be the same.

Thanks!
James
Posted: Wednesday, September 30, 2009 6:18:51 PM
Rank: Member
Groups: Member

Joined: 10/4/2008
Posts: 28
I'm not sure what you mean. There is no TextBox1 or Editor1 on this page. The 2 textboxes on my form are TextBoxCategory and TextBoxDescription.
eo_support
Posted: Wednesday, September 30, 2009 6:28:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
What we meant is whenever you have code that accesses a TextBox control's Text property, you would change it to access the Editor controls' Html property. So if you had a TextBox1 in your page and you replace it with Editor1, then you would change your code "TextBox1.Text" to "Editor1.Html". It has nothing to do with your DB or whatsoever.

Hope this clears up.

Thanks
James
Posted: Wednesday, September 30, 2009 6:47:44 PM
Rank: Member
Groups: Member

Joined: 10/4/2008
Posts: 28
Are you saying I need to replace all the asp:TextBox controls on my page with eo:Editor controls?
eo_support
Posted: Wednesday, September 30, 2009 7:33:17 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
My bad. I thought you were trying to replace TextBox with Editor. Sorry about that.

I am not exactly sure about your page structure. Do you have a separate page that contains a dialog, and then have the dialog's ContentUrl set to the page you posted? If that's the case, the easiest solution is to use the dialog's ContentTemplate instead of ContentUrl. That way everything is in the same page. You don't even need the code to call the click event of the link button in the parent window.

Thanks
James
Posted: Thursday, October 1, 2009 5:06:29 PM
Rank: Member
Groups: Member

Joined: 10/4/2008
Posts: 28
That worked. Thanks!
eo_support
Posted: Thursday, October 1, 2009 5:08:48 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
You are welcome. Glad that it works for you!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.