Donna Mar 15, 10:11 am show options
Newsgroups: microsoft.public.dotnet.framework.adonet
From: "Donna" <dyw...@yahoo.com> - Find messages by this author
Date: 15 Mar 2005 10:11:56 -0800
Local: Tues, Mar 15 2005 10:11 am
Subject: VB.NET dynamically create datagrid and set its datasource
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse
I try to dynamically add datagrid to my web form in VB.NET. But when I
try to setup the datasource, the DATASOURCE is not the property of
datagrid. Anybody know the reason?
I tried the same thing in C#, the DATASOURCE is the property of
datagrid and it works great.
thanks for your help 4 6177
Hi Donna:
DataSource is a property available on a DataGrid for all the
languages. Are you saying DataSource doesn't appear in the properties
window? Or doesn't compile?
--
Scott http://www.OdeToCode.com/blogs/scott/
On 15 Mar 2005 10:33:17 -0800, dy****@yahoo.com wrote: Donna Mar 15, 10:11 am show options
Newsgroups: microsoft.public.dotnet.framework.adonet From: "Donna" <dyw...@yahoo.com> - Find messages by this author Date: 15 Mar 2005 10:11:56 -0800 Local: Tues, Mar 15 2005 10:11 am Subject: VB.NET dynamically create datagrid and set its datasource Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse
I try to dynamically add datagrid to my web form in VB.NET. But when I
try to setup the datasource, the DATASOURCE is not the property of datagrid. Anybody know the reason?
I tried the same thing in C#, the DATASOURCE is the property of datagrid and it works great.
thanks for your help
Actually datasource is not the property of datagrid when you create the
datagrid in the run time instead of design time. Here is the code
Public Sub CreateGrid()
'declare a new datagrid and set properties
Dim DataGrid1 As New DataGrid()
'bind datagrid
'*************************************
'I will get error in here and tell me that
'datasource is not the property of DataGrid1
DataGrid1.DataSource = GetDataSet()
DataGrid1.DataBind()
'add datagrid to the page
Page.Controls(1).Controls.Add(DataGrid1)
End Sub
Any thought?
thanks
Scott Allen wrote: Hi Donna:
DataSource is a property available on a DataGrid for all the languages. Are you saying DataSource doesn't appear in the properties window? Or doesn't compile?
-- Scott http://www.OdeToCode.com/blogs/scott/
On 15 Mar 2005 10:33:17 -0800, dy****@yahoo.com wrote:
Donna Mar 15, 10:11 am show options
Newsgroups: microsoft.public.dotnet.framework.adonet From: "Donna" <dyw...@yahoo.com> - Find messages by this author Date: 15 Mar 2005 10:11:56 -0800 Local: Tues, Mar 15 2005 10:11 am Subject: VB.NET dynamically create datagrid and set its datasource Reply | Reply to Author | Forward | Print | Individual Message |
Showoriginal | Report Abuse
I try to dynamically add datagrid to my web form in VB.NET. But
when I try to setup the datasource, the DATASOURCE is not the property of datagrid. Anybody know the reason?
I tried the same thing in C#, the DATASOURCE is the property of datagrid and it works great.
thanks for your help
Hi:
On 15 Mar 2005 19:06:40 -0800, dy****@yahoo.com wrote: Actually datasource is not the property of datagrid when you create the datagrid in the run time instead of design time. Here is the code Public Sub CreateGrid() 'declare a new datagrid and set properties Dim DataGrid1 As New DataGrid()
'bind datagrid '************************************* 'I will get error in here and tell me that 'datasource is not the property of DataGrid1 DataGrid1.DataSource = GetDataSet() DataGrid1.DataBind()
'add datagrid to the page Page.Controls(1).Controls.Add(DataGrid1)
End Sub
Any thought? thanks
That seems odd, the only thing I can think of is that you have another
class by the name of DataGrid. Try:
Dim DataGrid1 As New System.Web.UI.WebControls.DataGrid
Any luck?
--
Scott http://www.OdeToCode.com/blogs/scott/
Scott,
Thank you very much. I thought that I import the
System.Web.UI.WebControls, then I could use datagrid directly. You
are right that there should be another class called datagrid somewhere
which I even did not know it exists. Thanks again
Donna This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: VM |
last post by:
If I'm filling a DataTable and, in the middle of the table fill, I set the
datagrid.datasource to this table, how can I stop the grid from reflecting
the changes from the table after I set the dartasource? Since I' m not sure
I'm explainng it well, here's some pseudocode:
for (int i =0;i<20000;i++)
{
rowAudit = mytable.NewRow();
// Code...
|
by: Billy |
last post by:
I have a web page with a control (Control#A) on it. The control (#A)
has a control (Control#B) on it which displays an exception message
when set and displayed. I am creating a simple datagrid dynamically
with delegates and assigning it to a placeholder on control #A. If,
within a delegate of the dynamically built datagrid, I set a property...
|
by: Quentin Huo |
last post by:
Hi:
I have a user control and I want to dynamically create a Label control and
TextBox control when the button "add more author name" is clicked.
I did like this:
1. there is a "PlaceHolder" control "ph" in the user control;
2. create a Label control and TextBox control when in the "add" button
|
by: vips |
last post by:
Page_Load
datagrid1.datasource=dataset1
//I am filling the datagrid and it works fine when page is displayed
end
---------------
|
by: pmclinn |
last post by:
I was wondering if it is possible to dynamically create a structure.
Something like this:
public sub main
sql = "Select Col1, Col2 from Table a"
dim al as new arraylist
al = LoadOracleData(sql)
'____Do amazing things
| |
by: Narshe |
last post by:
If I create a datagrid, and set a source and bind it, the data shows up
fine. When a postback occurs, the DataGrid.DataSource == null. Is there
something in the web.config I'm missing?
This is on asp.net 2.0.
|
by: rockdale |
last post by:
private void dgrid_OnItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType ==ListItemType.Item||e.Item.ItemType
==ListItemType.AlternatingItem)
DataRowView drv = (DataRowView)e.Item.DataItem;
it caught error.
|
by: Ryan Liu |
last post by:
Hi,
If a DataGrid.DataSource is an IList, not a DataTable, is there a way
similar to dt.AcceptChanges(), dt.RejectChanges()?
Thanks a lot!
Ryan Liu
|
by: rn5a |
last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB
table. The records retrieved depends upon 2 conditions (the conditions
depend on what a user selects in an ASPX page). If condition1 is true,
then the SqlDataReader will be populated with the records existing in
table1 & will return 0 to the calling function but if...
|
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...
|
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...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |