473,385 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Raising BubleEvents

I have created a custom TextBox by inheriting TextBox. My purpose in
this was so that I could raise a BubleEvent such that custom TextBoxes
that are child controls of a DataGrid would actually cause the
DataGrid's ItemCommand to be fired. Then I would know which row the
particular TextBox was in. Everything seems to work correctly.
However, when I get to the point that I do a FindControl on my
DataGrid object, I get a reference not set to an instance of an object
error. I have not messed with event manipulation at this level before.
So, I'm pretty certain I just doing something wrong. Does anyone know
how I could make certain that my event arguments includes the proper
datagrid item? Thanks in advance for any help that can be offered.
Below is the relevant code.

Public Class GridTextBox
Inherits System.Web.UI.WebControls.TextBox

Protected Event Command As DataGridCommandEventHandler

Protected Overridable Sub OnCommand(ByVal e As CommandEventArgs)
Dim handler As CommandEventHandler = CType(Events(e),
CommandEventHandler)
If Not (handler Is Nothing) Then
handler(Me, e)
End If

RaiseBubbleEvent(Me, e)
End Sub

Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
MyBase.OnTextChanged(e)
OnCommand(New CommandEventArgs("EditNotes", "Notes"))
End Sub
End Class
*******From CodeBehind Page:

Public Sub dgDetails_ItemCommand(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgDetails.ItemCommand
Select Case e.CommandName.ToString()
' This was done just to test if it was actually working...
Case "EditNotes"
Dim strTest As String
strTest = "notes"
CType(dgDetails.FindControl("txtNotesTab2"),
GridTextBox).Text() = strTest
End Select
End Sub
*******From ASPX Page:

<%@ Register TagPrefix="Custom" Namespace="ShopOrderTool" Assembly =
"ShopOrderTool" %>
..
..
..
</asp:datagrid><asp:datagrid id="dgDetails" Runat="server"
Width="100%" Visible="False" CellPadding="1"
AutoGenerateColumns="False" OnItemCommand="dgDetails_ItemCommand">
<ItemStyle Font-Size="XX-Small" Font-Names="Tahoma"></ItemStyle>
<HeaderStyle Font-Size="XX-Small" Font-Names="Tahoma"
Font-Bold="True" HorizontalAlign="Center" ForeColor="#DADEFE"
BackColor="#006699"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<ItemStyle></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtSeqTab2" Runat="server"
Font-Names="Tahoma" Font-Size="XX-Small" Width="35"></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="OCDTE"></asp:BoundColumn>
<asp:BoundColumn DataField="OWRKC"></asp:BoundColumn>
<asp:BoundColumn DataField="OORD"></asp:BoundColumn>
<asp:BoundColumn DataField="OOPNO"></asp:BoundColumn>
<asp:BoundColumn DataField="OOPDS"></asp:BoundColumn>
<asp:BoundColumn DataField="Quantity"></asp:BoundColumn>
<asp:BoundColumn DataField="PostQty"></asp:BoundColumn>
<asp:BoundColumn DataField="ODPRD"></asp:BoundColumn>
<asp:BoundColumn DataField="OMAC"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemStyle></ItemStyle>
<ItemTemplate>
<Custom:GridTextBox id="txtNotesTab2" Runat="server"
Font-Names="Tahoma" Font-Size="XX-Small" Width="160"
AutoPostBack="True"></Custom:GridTextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn Visible="False"></asp:BoundColumn>
<asp:BoundColumn Visible="False"></asp:BoundColumn>
<asp:BoundColumn Visible="False"></asp:BoundColumn>
<asp:BoundColumn DataField="OCRIT"
Visible="False"></asp:BoundColumn>
<asp:BoundColumn DataField="Notes"
Visible="False"></asp:BoundColumn>
</Columns>
</asp:datagrid>
Robert Brinson
Nov 17 '05 #1
0 1163

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: spe.stani.be | last post by:
SPE (Stani's Python Editor) is an open-source python IDE with auto indentation & completion, call tips, syntax coloring & highlighting, UML diagrams, class explorer, source index, auto todo list,...
1
by: Rajesh.V | last post by:
I have made a custom control in asp.net using webcontrols, and am raising my event. I find that if no control is hooked into the event it goes for a toss. I tried to find length of the delegate...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
0
by: Greg Park | last post by:
I have many user controls loading into a web page using Page.LoadControl However, I'm unable to figure out how to raise an event when a button is click or a check box is checked. I can have...
0
by: Joe Campbell | last post by:
I am encountering a problem raising WMI events from an asp.net application. The error received (as captured in the event log) is as follows: System.Runtime.InteropServices.COMException...
1
by: Klaus Jensen | last post by:
Hi! I often raise my own errors in code, and I just use ErrorNumber 1, since I do not use this number for anything (like maintaining a table of errornumbers or whatever). I then started...
4
by: Dave A | last post by:
I am developing a somewhat complex component at the moment and coincidently I am also reading the Framework Design Guidelines book. After reading the section about event raising I have re-written...
2
by: Gman | last post by:
Hi, I have created a usercontrol, a grid control essentially. Within it I have a class: clsGridRecord. I have coded the events such that when a user clicks on the grid, say, the events occur on...
4
by: sloan | last post by:
I"m trying to figure out what concept I'm missing here, or if its not a good idea .. or what. Here is my example.. code is below. I have an employee class. It has an event that can be raised....
0
by: Apu Nahasapeemapetilon | last post by:
Suggestions on cross-posting this issue would be appreciated. I've got a C# .NET DLL (CLR v1.1) that raises events into its container. When the container is a .NET application, raising the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.