Using Custom Expressions w/ GridView Buttons

  • Thread starter Thread starter aeden.jameson
  • Start date Start date
A

aeden.jameson

I have a drop-down list the I want to use to control the visibility of
button fields. Here's an example of one of my button fields,

<asp:ButtonField Visible='<%$ Code:ddlReason.SelectedValue =
Status.Review %>' CommandName="Review" Text="Review" />


The value of ddlReason.SelectedValue within the custom expression is
constant even if I select another value from the dropdown. Why does
this occur?

The code for the custom expression builder is,

<ExpressionPrefix("Code")> _
Public Class CodeExpressionBuilder
Inherits ExpressionBuilder


Public Overrides Function GetCodeExpression(ByVal Entry As
System.Web.UI.BoundPropertyEntry, ByVal ParsedData As Object, ByVal
Context As System.Web.Compilation.ExpressionBuilderContext) As
System.CodeDom.CodeExpression
Return New CodeSnippetExpression(Entry.Expression)
End Function
End Class

Cheers,
Aeden
 
I have a drop-down list the I want to use to control the visibility of
button fields. Here's an example of one of my button fields,

<asp:ButtonField Visible='<%$ Code:ddlReason.SelectedValue =
Status.Review %>' CommandName="Review" Text="Review" />

The value of ddlReason.SelectedValue within the custom expression is
constant even if I select another value from the dropdown. Why does
this occur?

The code for the custom expression builder is,

<ExpressionPrefix("Code")> _
Public Class CodeExpressionBuilder
Inherits ExpressionBuilder

Public Overrides Function GetCodeExpression(ByVal Entry As
System.Web.UI.BoundPropertyEntry, ByVal ParsedData As Object, ByVal
Context As System.Web.Compilation.ExpressionBuilderContext) As
System.CodeDom.CodeExpression
Return New CodeSnippetExpression(Entry.Expression)
End Function
End Class

Cheers,
Aeden

hi,
did you set autopostback=true to your dropdown??


nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd
 
Back
Top