Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wildman@noclient.net - 13 Feb 2008 17:07 GMT
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!
wildman@noclient.net - 13 Feb 2008 19:43 GMT
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
Angel - 13 Feb 2008 23:05 GMT
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.
Signature

aaa

> 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:
[quoted text clipped - 15 lines]
>
> Thanks for any help or information!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.