Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

What Event Do I find Changes to the grid with a template dropdown

Last post 09-09-2008 10:17 by topfuel. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 09-04-2008 11:07

    • topfuel
    • Not Ranked
    • Joined on 07-31-2008
    • Points 160

    What Event Do I find Changes to the grid with a template dropdown

    I am new to infragistics and am trying to find the grid row that fires when a change is made to a dropdown on the row, in the grid.  I know when the dropdown changes, but can't find correct event to get the grid row's other column info.

    So far I've tried updaterowbatch, updaterow, updategrid, updatecellbatch, updatecell and none seem to fire on postback.  

    I'm sure I'm missing something simple that someone has found long ago...

    Thanks!

    • Post Points: 20
  • 09-04-2008 12:49 In reply to

    Re: What Event Do I find Changes to the grid with a template dropdown

    You can get the row which cell's been updated within the arguments of the UpdateCell event

     

    protected void grid1_UpdateCell(object sender, CellEventArgs e)

    {

     UltraGridRow row = e.Cell.Row;

    }

    "Programming is an art form that fights back" _ Se habla español.
    • Post Points: 20
  • 09-04-2008 13:25 In reply to

    • topfuel
    • Not Ranked
    • Joined on 07-31-2008
    • Points 160

    Re: What Event Do I find Changes to the grid with a template dropdown

     i'm just not seeing this event fire when the drropdown changes or on postback

    • Post Points: 20
  • 09-04-2008 13:50 In reply to

    Re: What Event Do I find Changes to the grid with a template dropdown

    Handling this event should be pretty straight forward. You can do it using the properties tab of the webgrid or by code

     

    UltraWebGrid1.UpdateCell += new Infragistics.WebUI.UltraWebGrid.UpdateCellEventHandler(UltraWebGrid1_UpdateCell);

     

    void UltraWebGrid1_UpdateCell(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e)

    {

    //Here you can get the cell, column and row from which the update event was fired and access all of their methods and properties

    UltraGridCell cell = e.Cell;

    UltraGridColumn column = e.Cell.Column;

    UltraGridRow row = e.Cell.Row;

    }

     

    If it doesn't seem to work i'd recommend you to try with a dummy project to see if it works in a less complex environment and if it does, look at your project to see what else is going on there that could be messing things up.

     

    One final thought, maybe a silly thing. The updateCell event is fired after you end editing that cell.. That means you have to move on to another control to see this event fired :)

    "Programming is an art form that fights back" _ Se habla español.
    • Post Points: 20
  • 09-04-2008 15:51 In reply to

    • topfuel
    • Not Ranked
    • Joined on 07-31-2008
    • Points 160

    Re: What Event Do I find Changes to the grid with a template dropdown

     psych - thanks for your response and time...i've created the code and all, no problem...but let me state my problem this way...when I put a breakpoint inside the event, I never hit that breakpoint when ichange an item in the dropdown or postback

    Maybe I shouldn't be hitting it? or what

     protected void gridx_UpdateCell(object sender, CellEventArgs e)
            { - breakpoint here

               UltraGridCell cell = e.Cell; - breakpoint here
                {

                }
            }


    • Post Points: 20
  • 09-04-2008 16:01 In reply to

    Re: What Event Do I find Changes to the grid with a template dropdown

    It's hard to know what else could be wrong since, as i told you before, it should be an easy thing to do.. My only suggestion is that you make sure that  in your .ASPX file you have something like this

    <igtbl:UltraWebGrid ID="gridx" OnUpdateCell="gridx_UpdateCell" ... ....

    which sets the function you'll be calling when that event fires.. taht's usually set automatically.. That's the last thing I could think of

    "Programming is an art form that fights back" _ Se habla español.
    • Post Points: 20
  • 09-04-2008 17:05 In reply to

    • topfuel
    • Not Ranked
    • Joined on 07-31-2008
    • Points 160

    Re: What Event Do I find Changes to the grid with a template dropdown

     my final question...just wonder if the grid doesn't recognize a celltemplate dropdown in a templatedcolumn when it is changed?

    • Post Points: 20
  • 09-04-2008 17:41 In reply to

    Re: What Event Do I find Changes to the grid with a template dropdown

    I just tested it out and it does recognize it.. this is the code that i wrote

     

    TemplatedColumn tc = new TemplatedColumn();

    tc.Key = "TemplatedColumn";

    tc.Header.Caption = "TemplatedColumn";tc.Type = ColumnType.DropDownList;

     

    UltraWebGrid1.Columns.Add(tc);

    ValueList listaValores = new ValueList();

    listaValores.ValueListItems.Add(1, "One");

    listaValores.ValueListItems.Add(2, "Two");listaValores.ValueListItems.Add(3, "Three");

    tc.ValueList = listaValores;

     

    And of course, the handler

    UltraWebGrid1.UpdateCell += new Infragistics.WebUI.UltraWebGrid.UpdateCellEventHandler(UltraWebGrid1_UpdateCell);

     

    and the function itself

    void UltraWebGrid1_UpdateCell(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e)

    {

    }

    "Programming is an art form that fights back" _ Se habla español.
    • Post Points: 5
  • 09-05-2008 13:00 In reply to

    Re: What Event Do I find Changes to the grid with a template dropdown

    Guess what! I was playing around with the sample project I created in order to address this problem you were having and found out it happenned to me too! The project that was working so fine started to give me some trobule with this same thing (not being able to trigger the UpdateCell event). What I did to solve it was to especifically set the event handler in te ASPX file

    OnUpdateCell="UltraWebGrid1_UpdateCell"

    and change de protection level to public

    public void UltraWebGrid1_UpdateCell(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e)

     

    Hope this helps if you haven't found the answer yet.

    "Programming is an art form that fights back" _ Se habla español.
    • Post Points: 20
  • 09-08-2008 2:43 In reply to

    Re: What Event Do I find Changes to the grid with a template dropdown

    Hello All,

    I think I might have a suggestion here that could probably here a little. The ASPX template is parsed at the very beginning of the lifecycle of the Page (OnInit). This btw coincides with where Visual Studio places all event hooking by default. If you want to respond to a changed event, you need to wire the event as early as OnInit - doing so in Page_Load or in a postback event handler like button click may not work in all cases.

    So if you are witing events programmatically, just make sure you do so in OnInit.

    Best Regards,
    Rumen Stankov (MCSD.NET)
    The Infragistics ASP.NET Team
    • Post Points: 20
  • 09-08-2008 11:24 In reply to

    • topfuel
    • Not Ranked
    • Joined on 07-31-2008
    • Points 160

    Re: What Event Do I find Changes to the grid with a template dropdown

     thanks everyone for their help so far...i have done all of the above...here is what i still can't figure out...the OnSelectedIndexChanged event fires when i change an item in the dropdown that is a celltemplate in the grid...that is good because i need the value from the new item changed too, but i also need an id from the row of the grid and the "grid row"event don't seem to fire

    any other ideas?

    • Post Points: 5
  • 09-08-2008 12:21 In reply to

    • topfuel
    • Not Ranked
    • Joined on 07-31-2008
    • Points 160

    Re: What Event Do I find Changes to the grid with a template dropdown

     the only events that i see firing are the "active" events (row and cell)  selected and update events are not

    so one solution is to postback every time they change a dropdown, but i was hoping to do this in updatebatch because i have a row with 5 dropdowns and could have (usually do have) multiple rows

    • Post Points: 5
  • 09-08-2008 16:28 In reply to

    • topfuel
    • Not Ranked
    • Joined on 07-31-2008
    • Points 160

    Re: What Event Do I find Changes to the grid with a template dropdown

     so much for getting the data through a grid event i'm doing this in the dropdown event and it works perfect:

    DropDownList dropdownlist = (DropDownList)sender;
                CellItem ci = (CellItem)dropdownlist.Parent;
                int rownumber = ci.Cell.Row.Index;

    datastore = gridx.Rows[rownumber].Cells[0].Text;

    • Post Points: 20
  • 09-09-2008 10:03 In reply to

    Re: What Event Do I find Changes to the grid with a template dropdown

    I think I've just figured out why this is happening, and what you're doing here is the best solution I know of.

    When you have a templated column, you no longer have a direct connection between what's displayed in the cell and the value of the cell.

    Why is this?  Column templates may have more than one control, and the cell may not know which of those controls to use for its value, how to retrieve the value from any one of those controls, or if indeed it should use any of those controls at all to determine its value.

    An alternate solution is to listen to client-side events of the controls on your column template and use these to update the value of the corresponding cell.  However, this is a lot of work to implement.  The solution of using the server-side events of the controls in the column template is often just as effective, and is usually easier to do.

    Vince McDonald
    Manager of Developer Support, MCP
    Infragistics, Inc.

    Was this post helpful? Please let me know by using the star ratings and the "Answered" button from the forum's web interface.

    Need help? Find the various ways you can ask for help from Infragistics.
    • Post Points: 20
  • 09-09-2008 10:17 In reply to

    • topfuel
    • Not Ranked
    • Joined on 07-31-2008
    • Points 160

    Re: What Event Do I find Changes to the grid with a template dropdown

     yes, apparently that is true and thanks for the follow-up...i'm getting the row cell data i need when the OnSelectedIndexChanged fires for the dropdown (celltemplate) in the above code...works very nicely, its been an interesting learning journey

    thanks again to all who responded

    • Post Points: 5
Page 1 of 1 (15 items)
Powered by Community Server (Commercial Edition), by Telligent Systems