Hi,
i have my radgrid and i put in there a RadGridColumn Type ImageButton. I handle its fired Event in code behind with following method:
That way i retrieve the id, delete the entity in my database and rebind the DataSource to the radgrid so it updates its state to the new database state.
Questions:
The radGrid.Items[rowNr].KeyValues give me this back "{id:\"3\"}". Is the so cause i gave the radgrid this property:
<MasterTableView DataKeyNames="id"> ?
How would i be able to do it in another way retrieving this id?
I also have there a Invisible GridBoundColumn also holding the id. How would i be able to get that id?
Is there another way to actualize the radgrid (accept of my way or Rebind() which didnt work)?
Another attached handler method in the back wants to let the client download the chosen document, but i get following exception:
[System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}
I set EnablePostBackOnRowClick="true" but it didnt change anything. Is there a away to get that exception lost?
thx mario
i have my radgrid and i put in there a RadGridColumn Type ImageButton. I handle its fired Event in code behind with following method:
private void GridCommand(object o, Telerik.Web.UI.GridCommandEventArgs e) |
{ |
if (e.CommandName == "Delete") |
{ |
try |
{ |
int rowNr = e.Item.ItemIndex; |
int startSS = radGrid.Items[rowNr].KeyValues.IndexOf("\"") + 1; |
int endSS = radGrid.Items[rowNr].KeyValues.IndexOf("\"", startSS); |
int id = Convert.ToInt32(radGrid.Items[rowNr].KeyValues.Substring(startSS, endSS - startSS)); |
string filepath = BLDocument.DeleteDocument(id); |
if(File.Exists(filepath)) |
File.Delete(filepath); |
BindTo(); |
} |
catch (Exception ex) |
{ |
} |
} |
} |
That way i retrieve the id, delete the entity in my database and rebind the DataSource to the radgrid so it updates its state to the new database state.
Questions:
The radGrid.Items[rowNr].KeyValues give me this back "{id:\"3\"}". Is the so cause i gave the radgrid this property:
<MasterTableView DataKeyNames="id"> ?
How would i be able to do it in another way retrieving this id?
I also have there a Invisible GridBoundColumn also holding the id. How would i be able to get that id?
Is there another way to actualize the radgrid (accept of my way or Rebind() which didnt work)?
Another attached handler method in the back wants to let the client download the chosen document, but i get following exception:
[System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}
I set EnablePostBackOnRowClick="true" but it didnt change anything. Is there a away to get that exception lost?
thx mario