Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

convert checkbox code to link in asp.net and c#

Posted on 2012-03-09
2
Medium Priority
?
284 Views
Last Modified: 2012-03-26
hi,

I want to convert checkbox into link. Clicking on checkbox will expand/collapse table. How the below can be converted if the checkbox is a link.

<asp:CheckBox id=chkExpandView runat="server" Font-Names="Arial" Font-Size="X-Small" AutoPostBack=true  OnCheckedChanged="chkExpandView_CheckedChanged" />
                    <font size="2" face="Arial"> <b>Expand All</b></font>

C#
 protected string DisplayScriptExpandCollapse()
    {
        if (this.chkExpandView.))
            return "display:block;";
        else
            return "display:none;";
            }
0
Comment
Question by:Saroj13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 37705026
Do you want the CheckBox to use an <anchor> style, or change the CheckBox to a HyperLink control?
0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 2000 total points
ID: 37705052
You could use a asp:LinkButton:

<asp:LinkButton ID="hlExpandView" runat="server" CommandName="Display" CommandArgument="Expand" Text="Expand All" Font-Size="12" Font-Bold="true" OnCommand="hlExpandView_Command"></asp:LinkButton>

Then in code behind:

        protected void hlExpandView_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandArgument.ToString() == "Expand")
            {
                myTable.Visible = true;  //your table name here
                hlExpandView.CommandArgument = "Collapse";
            }
            else
            {
                myTable.Visible = false;   //your table name here
                hlExpandView.CommandArgument = "Expand";
            }
        }
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question