Hi guys;
I'm trying to bind a property of one User Control but it doesn't work. The User Control is inside a GridView.
//Just an example<asp:GridView ID="gvTraining" runat="server" ><Columns><asp:TemplateField><ItemTemplate><uc2:ExportFormTreinamento ID="Export" runat="server" CodigoTreinamento='<%# (int)Eval("TREI_CD_TREINAMENTO") %>' /></ItemTemplate></asp:TemplateField></Columns></asp:GridView>
The property "CodigoTreinamento" belongs to my UserControl.
//UserControl public partial class ExportFormTreinamento : System.Web.UI.UserControl { private int _codigoTreinamento { get; set; } public int CodigoTreinamento { get { return _codigoTreinamento; } set { _codigoTreinamento = value; } } protected void Page_Load(object sender, EventArgs e) { } protected void lbtnExportFormulario_Click(object sender, EventArgs e) { if (_codigoTreinamento > 0) { } } }
The method set is working fine but when the User Control is selected the property "CodigoTreinamento" has value 0.
I saw in another forum a question about it (link) and I'm doing almost the same thing. I tried to use "this.DataBind()" in the set method but it also doesn't work.
Any idea about what to do to fix this problem?
PS.: I'm using Update Panel. Would be it the reason of this problema?
Deise Vicentin
"Eu não procuro saber as respostas, procuro compreender as perguntas." Confúcio