Hi:
I have a RadGrid, the Radgrid contains a form template, his control are binding to a SqlDataSource.
When insert an element sends a mail (with .net libraries) into a mail that the user have inserted in a specific field.
The code works fine, but when the user introduce a invalid mail like 'badmail@badmail.com' when the user press insert button, send of mail fail (I manage the error in the event), radgrid shows what happen, but all fields are empty.
The code is the following
01. protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e) 02. { 03. 04. 05. 06. SqlDataSource1_Inserted 07. DbCommand command = e.Command; 08. DbConnection cx = command.Connection; 09. cx.Open(); 10. DbTransaction tx = cx.BeginTransaction(); 11. command.Transaction = tx; 12. } 13. 14. 15. 16. 17.protected void SqlDataSource1_Inserted(object sender, SqlDataSourceStatusEventArgs e) 18.{ 19. try20. { 21. DbCommand command = e.Command; 22. DbTransaction tx = command.Transaction; 23. //Here code that sends email, process can fail. 24. tx.Commit(); 25. } 26. catch (Exception exception) 27. { 28. tx.Rollback(); 29. throw exception; 30. } 31.} 32. 33.protected void RadGrid1_ItemInserted(object source, Telerik.WebControls.GridInsertedEventArgs e) 34. { 35. if (e.Exception != null) 36. { 37. e.ExceptionHandled = true; 38. e.KeepInInsertMode = true; 39. //Display a message to show the error 40. } 41. }I whish that when the sent of mail fails, all the data of the form were preserve ¿Is it possible?
Thanks.
Hello.
I it is necessary from Default.aspx to cause function in open window RadWindow. Function cause when window is loaded,
Default.spx javascript code:
var oWnd = GetRadWindowManager().getWindowByName( "RadWindow1");
oWnd.get_contentFrame().contentWindow.CalledFn();
Radwindow javascript code:
function calledFn()
{
alert("ok");
}
Error:Mistake of the execution Microsoft JScript: Object does not support this characteristic or method
That wrong?
This exemple working and the text "xxx items in yyy pages" is displayed
<PagerStyle AlwaysVisible="True" FirstPageToolTip="Début" LastPageToolTip="Fin" NextPagesToolTip="Page suivante" NextPageToolTip="Page suivante" PageSizeLabelText="Taille de page:" PrevPagesToolTip="Page précédente" PrevPageToolTip="Page précédente" ShowPagerText="True" Mode="NextPrevAndNumeric"/>
This pager not working. Test "xxx emails" is not displayed
<PagerStyle AlwaysVisible="True" FirstPageToolTip="Début" LastPageToolTip="Fin" NextPagesToolTip="Page suivante" NextPageToolTip="Page suivante" PageSizeLabelText="Taille de page:" PrevPagesToolTip="Page précédente" PrevPageToolTip="Page précédente" ShowPagerText="True" PagerTextFormat="{1} emails"
Mode="NextPrevAndNumeric"/><rad:RadGrid ...> <MasterTableView ...> <Columns> <rad:GridBoundColumn DataField="ID" UniqueName="ID" />
<!--...more columns...--> <rad:GridTemplateColumn UniqueName="Actions"> <ItemTemplate> <rad:RadToolBar ID="tbActions" Orientation="Horizontal" runat="server" OnButtonClick="tbActions_OnButtonClick" > <Items> <rad:RadToolBarButton ImageUrl="images/button1.png" Value="1" /> <rad:RadToolBarButton ImageUrl="images/button2.png" Value="2" /> <rad:RadToolBarButton ImageUrl="images/button3.png" Value="3" /> </Items> </rad:RadToolBar> </ItemTemplate> </rad:GridTemplateColumn> </Columns> <DetailTables> ... </DetailTables> </MasterTableView> </rad:RadGrid>protected void tbActions_OnButtonClick(object sender, RadToolBarEventArgs e) { //How can I get a reference to the GridDataItem that contains the toolbar //of the button that I just clicked? //this is not working: GridDataItem item = (GridDataItem)e.Item.ToolBar.Parent.Parent; string id; if (e.Item.Value == "1") { id = item["ID"].Text;
//more code here, use ID for db update } else if (e.Item.Value == "2") { id = item["ID"].Text;
//more code here, use ID for db update
} else if (e.Item.Value == "3") { id = item["ID"].Text;
//more code here, use ID for db update
} }