Hi there,
Very simple example of wht I'm trying to create here. It's so simple I can't figure out what am I doing wrong.
This is based on this example from Telerik. Basically I just wanna edit some text in my dynamically created dock.
Here's the code of the usercontrol I'm loading within my dock :
And the code behind:
Everything works perfectly except that I can't change the content of the textboxes. Their value are set properly, but it looks like I can't access them to edit the text.
As I said this is not rocket science but I can't figure out what's going on here.
Anyone have some idea ?
Thanks
Very simple example of wht I'm trying to create here. It's so simple I can't figure out what am I doing wrong.
This is based on this example from Telerik. Basically I just wanna edit some text in my dynamically created dock.
Here's the code of the usercontrol I'm loading within my dock :
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="widgetTemplate.ascx.cs" Inherits="NRP.Monitors.usercontrols.widgetTemplate" %>
<
div
class
=
"widget"
>
<
table
>
<
tr
>
<
td
rowspan
=
"2"
class
=
"wicon"
>
<
asp:Image
ID
=
"Wicon"
runat
=
"server"
/>
</
td
>
<
td
class
=
"wtitle"
>
<
asp:TextBox
ID
=
"TbTitle"
runat
=
"server"
Visible
=
"false"
></
asp:TextBox
>
<
asp:LinkButton
ID
=
"LbWtitle"
runat
=
"server"
OnClick
=
"LbWtitle_Click"
></
asp:LinkButton
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"wsubtitle"
>
<
asp:TextBox
ID
=
"TbSubtitle"
runat
=
"server"
Visible
=
"false"
></
asp:TextBox
>
<
asp:LinkButton
ID
=
"LbSubtitle"
runat
=
"server"
OnClick
=
"LbSubtitle_Click"
></
asp:LinkButton
>
</
td
>
</
tr
>
</
table
>
</
div
>
And the code behind:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
namespace
NRP.Monitors.usercontrols
{
public
partial
class
widgetTemplate : System.Web.UI.UserControl
{
public
string
Wtitle;
public
string
WSubtitle;
public
string
IconUrl;
public
widgetTemplate()
{
}
public
widgetTemplate(
string
wtitle,
string
wsubtitle,
string
iconUrl)
{
Wtitle = wtitle;
WSubtitle = wsubtitle;
IconUrl =
"../"
+ iconUrl;
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
LbWtitle.Text = Wtitle;
LbSubtitle.Text = WSubtitle;
Wicon.ImageUrl = IconUrl;
}
protected
void
LbWtitle_Click(
object
sender, EventArgs e)
{
if
(TbTitle.Visible)
{
LbWtitle.Text = TbTitle.Text;
Wtitle = TbTitle.Text;
TbTitle.Visible =
false
;
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"enabledrag"
,
"enableDockDrag(true);"
,
true
);
}
else
{
TbTitle.Text = LbWtitle.Text;
LbWtitle.Text =
"OK"
;
TbTitle.Visible =
true
;
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"enabledrag"
,
"enableDockDrag(false);"
,
true
);
}
}
protected
void
LbSubtitle_Click(
object
sender, EventArgs e)
{
if
(TbSubtitle.Visible)
{
LbSubtitle.Text = TbSubtitle.Text;
WSubtitle = TbSubtitle.Text;
TbSubtitle.Visible =
false
;
}
else
{
TbSubtitle.Text = LbSubtitle.Text;
LbSubtitle.Text =
"OK"
;
TbSubtitle.Visible =
true
;
}
}
}
Everything works perfectly except that I can't change the content of the textboxes. Their value are set properly, but it looks like I can't access them to edit the text.
As I said this is not rocket science but I can't figure out what's going on here.
Anyone have some idea ?
Thanks