I am adding the columns to my radgrid dynamically, in page_load as shown in the link,
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section1
using the method
- declare the RadGrid control in the ASPX file and define its structure in the code-behind.
Now, the issue is that, whenever a postback occurs in the page, my deletecolumn disappears. Obviously this is because I am checking for ispostback in my CreateGridDynamically() method. But then, why all other columns are populated after postback then?
What I need to have is a deletecolumn(either template column or gridbuttoncolumn). I tried to add the template column. but as it was written in that link, it needed to call the method in page_init. Then my needdatasource didn’t work. In effect, my grid didn’t bind with data at all. So, I was trying to add the gridbutton column. now, that works (I mean delete column is shown initially). But whenever a postback occurs in the page(may be with some other ddl change), the column becomes hidden. I removed the ispostback checking , but that resulted in all columns added twice to the grid, after a postback. So, is there any other grid event where I need to add the deletecolumn to make it show after postback, or what may be the wrong thing in my code?
btw, i can click on my delete button and it fires the itemcommand. but even if i added the commandname for the deletecolumn, the e.commandName appears as "" in the itemcommand. Does it have a relation to what am doing? what can i do to get the actual command name instead?
Please help me to get aroud this. Any help is appreciated.
Veena
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section1
using the method
- declare the RadGrid control in the ASPX file and define its structure in the code-behind.
Now, the issue is that, whenever a postback occurs in the page, my deletecolumn disappears. Obviously this is because I am checking for ispostback in my CreateGridDynamically() method. But then, why all other columns are populated after postback then?
What I need to have is a deletecolumn(either template column or gridbuttoncolumn). I tried to add the template column. but as it was written in that link, it needed to call the method in page_init. Then my needdatasource didn’t work. In effect, my grid didn’t bind with data at all. So, I was trying to add the gridbutton column. now, that works (I mean delete column is shown initially). But whenever a postback occurs in the page(may be with some other ddl change), the column becomes hidden. I removed the ispostback checking , but that resulted in all columns added twice to the grid, after a postback. So, is there any other grid event where I need to add the deletecolumn to make it show after postback, or what may be the wrong thing in my code?
btw, i can click on my delete button and it fires the itemcommand. but even if i added the commandname for the deletecolumn, the e.commandName appears as "" in the itemcommand. Does it have a relation to what am doing? what can i do to get the actual command name instead?
Please help me to get aroud this. Any help is appreciated.
Veena