How to populate C1GridView from C# codebehind

Posted by: jhgarniss on 10 September 2017, 11:36 am EST

  • Posted 10 September 2017, 11:36 am EST

    <p>Hi all,</p>
    <p>I have a good idea of how to work with the C1GridView when it is bound to a specific table in a DB, no problem.</p>
    <p> </p>
    <p>However, I'd like to be able to populate a gridview based upon a DB View instead. Is it simply a matter of using the select from a view instead of the DB? Logic says yes. I tried to add columns to an unbound gridview, but the grouping functionality wouldn't show up when I tried it.</p>
    <p>Also, is there a way to populate the gridview ONLY when an action is taken? I have 6 tabs, each with a gridview. I'd like to populate the 5 that are not defaulted to ONLY when the user clicks on the tab. Is there a way to keep those 5 from populating on page load, then populate them when the user clicks the tab?</p>
    <p> </p>
    <p>Thanks, in advance!</p>
    <p>Jon</p>
  • Replied 10 September 2017, 11:36 am EST

    <p>Grouping doesn't work if the grid has row autogeneration turned on. Make sure that AutogenerateColumns property is off.</p>
    <p>>>Also, is there a way to populate the gridview ONLY when an action is taken? </p>
    <p>protected void OnTabChanged()</p>
    <p>{</p>
    <p>  C1GridView.DataSource = GetDataSource();</p>
    <p>  C1GridView.DataBind();</p>
    <p>}</p>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels