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 / April 2008

Tip: Looking for answers? Try searching our database.

nettiers and gridview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gabriel Pineda - 08 Apr 2008 04:45 GMT
hi, i have already binded a gridview and the data.
in my aspx i have something like that:
<asp:TemplateField><HeaderTemplate>Select</HeaderTemplate>

<ItemTemplate>

<asp:HyperLink id="SelectLink" runat="server" NavigateUrl='<%#
"~/patientBook_step2.aspx?idtreatment=" + Eval("IDTreatment") +
"&idpatient=" + Request.QueryString["id"]%>'><img border='0'
src='App_Themes/AdXToDefault/Images/16x16/flag.png'></asp:HyperLink>

</ItemTemplate>

and now what i want to do is to show or to not show the hyperlink depending
on the value of another field (like 'active' or something like that).

how can i do that?
thank you!
David R. Longnecker - 08 Apr 2008 16:41 GMT
In your code-behind, I'd recommend adding a RowDataBound event that sets
the Visible property of your SelectLink to false based on whatever column/field
you're interested in.  The e.Row.Cells[index] would be based on the column
order of your grid.

ex:

       protected void ExampleGrid_RowDataBound(object sender, GridViewRowEventArgs
e)
       {
           if (e.Row.Cells[3].Text == "Inactive")
           {
               ((HyperLink) e.Row.FindControl("SelectLink")).Visible = false;
           }
       }

HTH.

-dl

--
David R. Longnecker
http://blog.tiredstudent.com

> hi, i have already binded a gridview and the data. in my aspx i have
> something like that:
[quoted text clipped - 15 lines]
> how can i do that?
> thank you

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.