Gridview only show row button if something was selected and somethinghas been entered??

W

wildman

I've coded a gridview that has used bound data to determine if I
should show a button on a particular gridview row as follows:

<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Submit" Text="Test" CommandArgument='<
%#Eval("CNumber") %>' CommandName="Submit" Enabled='<%#
Test(Eval("ProcessId")) %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>

Question is, how can I do the samething, but based on the value of
other columns that are yet to posted?

For example say I have a textbox column and dropdown column in the
grid. I only want the button to be visible if something has been
entered into the textbox and something has been selected on that row.

Thanks for any help or information!
 
W

wildman

Update on this.

I figured I might be able to accomplish this with in the rowcreated
event of the gridview. However, oddly enough, when I test my
dropdown's selected value, it's always showing the default selected
value, regardless of current viewstate value.

Any ideas?



Protected Sub AddPoints_RowCreated(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.GridViewRowEventArgs) Handles
gridAddPoints.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
Dim minutes As String =
CType(e.Row.Cells(4).FindControl("Minutes"),
DropDownList).SelectedValue
If Not minutes = "Enter Minutes" Then
' NEVER TRUE THOUGH I DO SELECT ANOTHER VALUE.
Dim SubmitPoint As Button =
CType(e.Row.Cells(5).Controls(0), Button)
SubmitPoint.Enabled = "True"
End If
End If
End Sub
 
A

Angel

It must be the week for the GridView... You like someone else earlier have
what appears to be a mix of thing you want to do with the grid. I would
suggest that if you have something that is not working you post the code and
that will make life a lot easier for to help you.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top