I have gridview and chart below it.
I want gridview stretch depending on number of columns (not set width) and after that to assign that width to chart.
If I do:
chart.Width = gridview.Width.Value;
I get 0.0 pixels.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It won’t work this way, the width you need is the client-side value and you cannot get it from the server-side.
Try moving the resize chart logic to javascript, use the .offsetWidth/.clientWidth properties of the table (gridview). Or you can modify mark-up to make you chart stretch automatically (put the grid and the chart into a common container and stretch the chart to fill the width of the container).