473,943 Members | 15,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Override Datagrid from function

Hello NG,

i have the following function which works fine:

Public Shared Function getFullDatagrid () As
System.Web.UI.W ebControls.Data Grid

Dim myGrid As New System.Web.UI.W ebControls.Data Grid()

Dim bcn1 As New BoundColumn()

bcn1.HeaderText = "T55"

bcn1.DataField = "DocumentID "

myGrid.Columns. Add(bcn1)

myGrid.Enabled = True

myGrid.EnableVi ewState = True

myGrid.DataSour ce = getData("test")

myGrid.DataBind ()

Return myGrid

End Function
In Page_Load i call the function:

DataGrid1 = getFullDatagrid ()

But the datagrid is not displayed. All the propertys like
"DataGrid1.Colu mns.Count" , "DataGrid1.Item s.Count" can be shown in a
layer.

Do you know what is going wrong here?

Thank You
Ralf
Jun 11 '07 #1
4 1345
Hi

Do you add your newly created control to the page? If you create your control
dynamically you need to add it to the page. The simplest way is to put a
PlaceHolder control at your web page and add your grid to the control by
calling:

PlaceHolder1.Co ntrols.Add(myGr id)
-yuriy
Hello NG,

i have the following function which works fine:

Public Shared Function getFullDatagrid () As
System.Web.UI.W ebControls.Data Grid

Dim myGrid As New System.Web.UI.W ebControls.Data Grid()

Dim bcn1 As New BoundColumn()

bcn1.HeaderText = "T55"

bcn1.DataField = "DocumentID "

myGrid.Columns. Add(bcn1)

myGrid.Enabled = True

myGrid.EnableVi ewState = True

myGrid.DataSour ce = getData("test")

myGrid.DataBind ()

Return myGrid

End Function

In Page_Load i call the function:

DataGrid1 = getFullDatagrid ()

But the datagrid is not displayed. All the propertys like
"DataGrid1.Colu mns.Count" , "DataGrid1.Item s.Count" can be shown in a
layer.

Do you know what is going wrong here?

Thank You
Ralf

Jun 11 '07 #2
Hello,

i have created a datagrid in designview in VS:

Protected WithEvents DataGrid1 As System.Web.UI.W ebControls.Data Grid
.......
' --- This works: DataGrid1 = getData("test")

'This seems to be work fine, but it isnt shown on the screen
DataGrid1 = getFullDatagrid ()
Hope You understand what i mean.

Ralf


"Yuriy Solodkyy" <y.************ @gmail.comschri eb im Newsbeitrag
news:57******** *************** ****@msnews.mic rosoft.com...
Hi

Do you add your newly created control to the page? If you create your
control dynamically you need to add it to the page. The simplest way is
to put a PlaceHolder control at your web page and add your grid to the
control by calling:

PlaceHolder1.Co ntrols.Add(myGr id)
-yuriy
>Hello NG,

i have the following function which works fine:

Public Shared Function getFullDatagrid () As
System.Web.UI. WebControls.Dat aGrid

Dim myGrid As New System.Web.UI.W ebControls.Data Grid()

Dim bcn1 As New BoundColumn()

bcn1.HeaderTex t = "T55"

bcn1.DataFie ld = "DocumentID "

myGrid.Columns .Add(bcn1)

myGrid.Enabl ed = True

myGrid.EnableV iewState = True

myGrid.DataSou rce = getData("test")

myGrid.DataBin d()

Return myGrid

End Function

In Page_Load i call the function:

DataGrid1 = getFullDatagrid ()

But the datagrid is not displayed. All the propertys like
"DataGrid1.Col umns.Count" , "DataGrid1.Item s.Count" can be shown in a
layer.

Do you know what is going wrong here?

Thank You
Ralf


Jun 11 '07 #3

As you create new instance of the control you still need to add this newly
added control to the page. You may try adding it to the same parent control
as the old one which is created by the designer.

Try something like:

Dim temp as DataGrid
temp = DataGrid1
DataGrid1 = getFullDatagrid ()
temp.Parent.Con trols.Add(DataG rid1)

However, I owuld recommend replacing the grid created in designer with PlaceHolder
control and then using dynamic control by adding it to the placeholder.

-yuriy
Hello,

i have created a datagrid in designview in VS:

Protected WithEvents DataGrid1 As System.Web.UI.W ebControls.Data Grid
......

' --- This works: DataGrid1 = getData("test")

'This seems to be work fine, but it isnt shown on the screen DataGrid1
= getFullDatagrid ()

Hope You understand what i mean.

Ralf

"Yuriy Solodkyy" <y.************ @gmail.comschri eb im Newsbeitrag
news:57******** *************** ****@msnews.mic rosoft.com...
>Hi

Do you add your newly created control to the page? If you create
your control dynamically you need to add it to the page. The
simplest way is to put a PlaceHolder control at your web page and add
your grid to the control by calling:

PlaceHolder1.C ontrols.Add(myG rid)

-yuriy
>>Hello NG,

i have the following function which works fine:

Public Shared Function getFullDatagrid () As
System.Web.UI .WebControls.Da taGrid
Dim myGrid As New System.Web.UI.W ebControls.Data Grid()

Dim bcn1 As New BoundColumn()

bcn1.HeaderTe xt = "T55"

bcn1.DataFiel d = "DocumentID "

myGrid.Column s.Add(bcn1)

myGrid.Enable d = True

myGrid.Enable ViewState = True

myGrid.DataSo urce = getData("test")

myGrid.DataBi nd()

Return myGrid

End Function

In Page_Load i call the function:

DataGrid1 = getFullDatagrid ()

But the datagrid is not displayed. All the propertys like
"DataGrid1.Co lumns.Count" , "DataGrid1.Item s.Count" can be shown in
a layer.

Do you know what is going wrong here?

Thank You
Ralf

Jun 11 '07 #4
You are right: Placeholder works fine.
Thanks!

Greets
Ralf

"Yuriy Solodkyy" <y.************ @gmail.comschri eb im Newsbeitrag
news:57******** *************** ****@msnews.mic rosoft.com...
Hi

Do you add your newly created control to the page? If you create your
control dynamically you need to add it to the page. The simplest way is
to put a PlaceHolder control at your web page and add your grid to the
control by calling:

PlaceHolder1.Co ntrols.Add(myGr id)
-yuriy
>Hello NG,

i have the following function which works fine:

Public Shared Function getFullDatagrid () As
System.Web.UI. WebControls.Dat aGrid

Dim myGrid As New System.Web.UI.W ebControls.Data Grid()

Dim bcn1 As New BoundColumn()

bcn1.HeaderTex t = "T55"

bcn1.DataFie ld = "DocumentID "

myGrid.Columns .Add(bcn1)

myGrid.Enabl ed = True

myGrid.EnableV iewState = True

myGrid.DataSou rce = getData("test")

myGrid.DataBin d()

Return myGrid

End Function

In Page_Load i call the function:

DataGrid1 = getFullDatagrid ()

But the datagrid is not displayed. All the propertys like
"DataGrid1.Col umns.Count" , "DataGrid1.Item s.Count" can be shown in a
layer.

Do you know what is going wrong here?

Thank You
Ralf


Jun 11 '07 #5

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

Similar topics

0
2060
by: Andr?s Guerrero | last post by:
Hi, I'm need to test a php script that sends email messages, I'm using a windows local machine (without internet connection), so I can't set an smtp server in php.ini, but I need to see the content of the messages, so I think I have three choices: (1) get something like a "sendmail" emulator that stores the messages in files instead of sending them, (2) install a smtp server, (3) the easiest I think, override the mail() function with a...
3
1704
by: Matt | last post by:
Hello, I'm trying to implement the design below. I'd prefer to use commented operator+() in class Number instead of the associated, uncommented operator+(), but as I understand Covariant Return Types, one is not allowed to return non-references (eg, references or pointers) in virtual-functions (which seems to make sense given the seemingly polymorphic nature). So...I use the hack below and make my Object-return function be
2
1626
by: seberino | last post by:
I'm trying run a homegrown profiler on some Python code. Rather than apply profiler wrapper to ALL functions by hand.... Is there a low level Python function I can override to modify how ALL functions are called? Chris
1
3397
by: MrNobody | last post by:
Is it at all possible to override the default behavior of a DataGrid when the mouse is clicked on a row? I am having a problem where I am trying to select multiple rows in a DataGrid by left-clicking them, but each time I click another row to add it to the selection the previously added row loses it's highlighting, so it appears as though only one row is selected at any one time.
1
6855
by: Steve | last post by:
I would like to override the IsInputKey function in order to trap the arrow up/down keys in the Key Events. I understand that arrow keys don't have a char representation and thus, hard to trap. Someone wrote this override for IsInputKey in C# which apparently worked, and I tried to convert it to VB.Net but not working. Here is the C# version and following - my conversion. It would be great if anyone out there knows how to do this...
0
1092
by: John Smith | last post by:
Is it possible to customize the DataGrid so that I can gain access to the RowHeader colomn? I want to move the Arrow and Pencil graphics down on each row so that it is centered vertically in the expanded row height. Any suggestions? Thanks.
4
2245
by: mitch | last post by:
Is there a way to reassign a function? I tried this: function func() { alert("func"); } function func2() { alert("func2"); } function testFunc() { document.func = func2; func(); }
2
8296
by: jeremito | last post by:
I have created a class that inherits from the list object. I want to override the append function to allow my class to append several copies at the same time with one function call. I want to do something like: import copy class MyList(list): __init__(self): pass
1
18622
by: rakeshvthu | last post by:
hi, i have a javascript function in baselayout.jsp for document.onkeydown i want to override it in my other jsp. how can i do that, pls help thanks, Rakesh
0
10135
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11299
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8219
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6308
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4910
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.