Quantcast
Channel: Our ComponentOne » All Posts
Viewing all articles
Browse latest Browse all 14170

Reply To: Set C1Button Visibility

$
0
0

Hi,

The LeftButtonClick event does not fire even at my end. Since the buttons become invisible when the left button is clicked, it gave an impression that the leftbuttonclick event was getting fired. It appears that the OnClick event of the LeftButton is never meant to be fired because the LeftButton is not rendered as a button but as a div.

As workaround for this, we can handle the OnClientClick event of the LeftButton and call its doPostBack() method. This would trigger the Page_Load event. We can then check the value of the EVENTTARGET parameter and write our code. Here’s the relevant markup and code :

<LeftButton ButtonType="Back" OnClientClick="LeftButton_Click" />
function LeftButton_Click(e, args) {                
                args.get_button().doPostBack();                
            }
protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            C1ViewPort1.LeftButton.ID = "LeftButton1″;
        }

        if (Request.Params["__EVENTTARGET"] != null)
        {
            if (Request.Params["__EVENTTARGET"].Contains("LeftButton"))
            {
                //write your code here
            }
        }
    }

The important thing to note here is that we’re setting the ID of the LeftButton in code. The ID property does not show in the intellisense, however, it works perfectly if you enter it manually.

I’ve attached the modified sample along with. Please take a look and let me know if you’re still facing any issues.

Regards
Abdias


Viewing all articles
Browse latest Browse all 14170

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>