| <telerik:RadGrid ID="rgSucursales" runat="server" AllowPaging="True" AllowSorting="True" |
| GridLines="None" onneeddatasource="rgSucursales_NeedDataSource" |
| VirtualItemCount="1" onitemcommand="rgSucursales_ItemCommand" |
| onitemdatabound="rgSucursales_ItemDataBound" > |
| <PagerStyle FirstPageToolTip="Primera Página" /> |
| <MasterTableView PageSize="5"> |
| <Columns> |
| <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Editar" |
| ImageUrl="img/editar.png" Text="Editar Cuenta" UniqueName="column"> |
| </telerik:GridButtonColumn> |
| <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Eliminar" |
| ImageUrl="img/eliminar.png" Text="Eliminar Cuenta" UniqueName="EliminarColumna" > |
| </telerik:GridButtonColumn> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings EnableAlternatingItems="False"> |
| <Selecting AllowRowSelect="False" /> |
| <ClientMessages PagerTooltipFormatString="Página <strong>{0}</strong> de <strong>{1}</strong>" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| protected void rgSucursales_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| string cmd = e.CommandName.ToString(); |
| if (cmd.Equals("Editar")) |
| { |
| Session["BANEDIT"] = item["Codigo"].Text; |
| rwSucursales.NavigateUrl = "~/OperCat.aspx"; |
| rwSucursales.Visible = true; |
| } |
| else if (cmd.Equals("Eliminar")) |
| { |
| GridDataItem item = (GridDataItem)e.Item; |
| ImageButton deleteBtn = (ImageButton)item["EliminarColumna"].Controls[0]; |
| deleteBtn.Attributes.Add("OnClick", "if(!confirm('¿Está seguro que desea Realizar la Venta?')){return false;};"); |
| var codigoEliminar = item["Codigo"].Text; |
| if (_dbase.DeleteQuery("Delete From tb where id_Bs=" + codigoEliminar).Equals("Ok")) |
| { |
| //Row deleted |
| "AlertSucess('#effect','¡La Cuenta ha sido eliminada!');", true); |
| } |
| else |
| { |
| //Problem in query |
| } |
| } |
| } |



<
script type="text/javascript"> (note VS2008 tells me a "type" is required, so I changed the script here)
function OnClientButtonClicked(sender, args) {
var button = args.get_item();
alert(button.get_text());
}
</
script>
<
telerik:RadToolBar id="RadToolBar1" runat="server" Orientation="Horizontal" OnClientButtonClicked="OnClientButtonClicked">
<CollapseAnimation Duration="200" Type="OutQuint" />
<Items>
<telerik:RadToolBarButton Text="button1" runat="server"></telerik:RadToolBarButton>
<telerik:RadToolBarDropDown Text="dropdown" runat="server">
<Buttons>
<telerik:RadToolBarButton Text="Button2" runat="server"></telerik:RadToolBarButton>
</Buttons>
</telerik:RadToolBarDropDown>
</Items>
</
telerik:RadToolBar>
| protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) |
| { |
| string strPrimary = string.Empty; |
| string sCopy = string.Empty; |
| if (e.Row.RowType == DataControlRowType.DataRow) |
| { |
| Label lblRole = (Label)e.Row.FindControl("lblRole"); |
| RadioButtonList rbroles = (RadioButtonList)e.Row.FindControl("rbroles"); |
| Label lbldelete = (Label)e.Row.FindControl("lbldelete"); |
| rbroles.SelectedValue = lblRole.Text; |
| CheckBox chk = (CheckBox)e.Row.FindControl("chkUser1"); |
| if (lbldelete != null) |
| { |
| if (string.Compare(lbldelete.Text, "true", true) == 0) |
| //if (lbldelete.Text.Equals("true",StringComparison.InvariantCultureIgnoreCase) |
| { |
| chk.Checked = true; |
| } |
| } |
| if (hdnCurrenUserRole.Value.Length > 0) |
| { |
| currentUserRole = Int32.Parse(hdnCurrenUserRole.Value); |
| } |
| if (currentUserRole == (int)Role.Owner || IsAdmin) |
| { |
| rbroles.Enabled = true; |
| chk.Enabled = true; |
| } |
| else |
| { |
| rbroles.Enabled = false; |
| chk.Enabled = false; |
| } |
| } |
| } |