0

Hi,
I'm planning to develop a web erp like application.
In this, i like to make common buttons for new, insert function.(like open bravo web erp).
How can i acheive this?
I dont think its not a good practise to include this int master pages or user controls .. any other idea??
plz explaine.
Thanks

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by reach_yousuf
0

Hello

For the same requirement in my project, i ended up writing a custom user control rather than using a third party toolbar controls or toolbar iewebcontrols

Create simple custom toolbar

Its light, simple and easy to use

user control .ascx

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ActionToolBar.ascx.vb" Inherits="Inventory.ActionToolBar" %>
<div style="float: left;">
    <table>
        <tr>
            <td>
                <asp:ImageButton ID="ibtnEdit" runat="server" ImageUrl="~/Images/edit.gif" Width="50px"  />
                <asp:ImageButton ID="ibtnSave" runat="server" ImageUrl="~/Images/save.gif" Width="50px"  />
                <asp:ImageButton ID="ibtnDelete" runat="server" ImageUrl="~/Images/delete.gif" Width="50px" />
            </td>
        </tr>
     </table>
</div>

User control code behind .ascx.vb

Public Partial Class ActionToolBar
    Inherits System.Web.UI.UserControl
    Public Event SaveEvent(ByVal sender As Object, ByVal e As EventArgs)
    Public Event EditEvent()
    Public Event DeleteEvent()
    Private Sub ibtnEdit_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnEdit.Click
        RaiseEvent EditEvent()
    End Sub
    Private Sub ibtnSave_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnSave.Click
        RaiseEvent SaveEvent(sender, e)
    End Sub
    Private Sub ibtnDelete_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnDelete.Click
        RaiseEvent DeleteEvent()
    End Sub
End Class

i call this tool bar in content page rather than master page
to register the user control in .aspx

<%@ Register TagPrefix="uc1" TagName="ActionToolbar" Src="~/ActionToolBar.ascx"  %>

toolbar consumer page code behind

Public Partial Class ToolBarConsumer
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim ToolbarPage As Main
        ToolbarPage = CType(Me.Master, Main)

        ToolbarPage.SaveEvent = New Main.ToolbarDelegate(AddressOf SAVE)
        ToolbarPage.CancelEvent = New Main.ToolbarDelegate(AddressOf CANCEL)
    End Sub

    Private Sub SAVE(ByVal sender As Object, ByVal e As EventArgs)
        Label1.Text = "Save button"
    End Sub

    Private Sub CANCEL(ByVal sender As Object, ByVal e As EventArgs)
        Label1.Text = "Cancel Button"
    End Sub

End Class

Mark as solved if it helps you

Edited by Nick Evan: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.