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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top