|
Okay, now it's much clearer and I guess I know the reason . Here, it's clear that the tcCollaborator.DataItem("Name") object is null, and that throws the exception when you use the ToString method of the null object. The reason this object is null is that you are trying to get the data object bound to the container using the DataItem property, and basically it only has value after data is bound to the control, but here you put your code in the InstantiateIn method which occurs before the data binding happens. So you can use the DataBinding event of the lCollaborator object and put your code to query the data item and set the Text property in the event handler
|
|
|
|
|
Hi,
I read carefully what you wrote and I got the same error after making a few changes to my code.
This is what I did:
' InstantiateIn
Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
' Define template container
Dim tcCollaborator As ComponentArt.Web.UI.GridServerTemplateContainer = CType(container, ComponentArt.Web.UI.GridServerTemplateContainer)
' Add lCollaborator data binding handler
AddHandler lCollaborator.DataBinding, AddressOf lCollaborator_DataBinding
' Add item template child controls
container.Controls.Add(lCollaborator)
End Sub ' InstantiateIn
' lCollaborator_DataBinding
Private Sub lCollaborator_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
' Create and define lCollaborator
Dim lCollaborator As Label = CType(sender, Label)
' Create and define lNews container
Dim container As ComponentArt.Web.UI.GridServerTemplateContainer = CType(lCollaborator.NamingContainer, ComponentArt.Web.UI.GridServerTemplateContainer)
' Define lCollaborator text
lCollaborator.Text = "Name: " & container.DataItem("Name").ToString
End Sub ' lCollaborator_DataBinding
Any idea? I am completely out of ideas ...
Thanks,
Miguel
|
|
|
|
|
Now, you might want to debug to see what the container.DataItem("Name") contains. Does it really have any column/property named "Name"?
|
|
|
|
|
Hi,
To be honest I am not able to debug and see what is inside container.DataItem("Name").
However, in the code I posted I have the function which creates the DataTable:
Public Shared Function Collaborators() As DataTable
' Create collaborators data table
Dim dtCollaborators As New DataTable
' Add columns to collaborators data table
With dtCollaborators.Columns
.Add(New DataColumn("Name", GetType(String)))
.Add(New DataColumn("Mobile", GetType(String)))
.Add(New DataColumn("Email", GetType(String)))
.Add(New DataColumn("City", GetType(String)))
End With
' Create and add a new collaborator row
Dim drRow01 As DataRow
drRow01 = dtCollaborators.NewRow
' Define collaborator row values
drRow01("Name") = "John"
drRow01("Mobile") = "983498223"
drRow01("Email") = "john@mydomain.com"
drRow01("City") = "New York"
' Add row to collaborators data table
dtCollaborators.Rows.Add(drRow01)
' Create and add a new collaborator row
Dim drRow02 As DataRow
drRow02 = dtCollaborators.NewRow
' Define collaborator row values
drRow02("Name") = "Andrew"
drRow02("Mobile") = "983498223"
drRow02("Email") = "andrew@mydomain.com"
drRow02("City") = "Paris"
' Add row to collaborators data table
dtCollaborators.Rows.Add(drRow02)
' Return collaborators data table
Return dtCollaborators
End Function ' Collaborators
It seems ok, right?
What should I do? How can I see what is inside container.DataItem("Name") as you mentioned?
Thank You,
Miguel
|
|
|
|
|
Just curious why you cannot debug the code? Anyway, you need to write some information to the web page ( simply using the Response object) or a log file to investigate which type of the container.DataItem object. Is it the DataRowView? Can you then also try to cast something like CType(container.DataItem, DataRowView)("Name").ToString()?
|
|
|
|
|
hi friends
i have a big query on my online examination project using asp.net
i want use case,activity,ER, data flow ,all the UML diagram for my project.if anyone have thn plz send me on my e mail address and if someone made already thios project thn also send me on my e mail address
my e mail add is hardik_patel75@yahoo.co.in
plz i needed it its urgent for me
hardik_75
|
|
|
|
|
What do you mean by 'use' ? You can show bitmaps in your form, whatever they are.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I think you should re-evaluate your learning methods....
|
|
|
|
|
Hi friends
i have 36 textboxs,i want to entered the data in all textboxes click the
submitt button data stored in database.how i get 36 textbox value in array.
thanks in advance
regards
saravanan
|
|
|
|
|
Why even bother with an array? It's just an extra step to the database.
|
|
|
|
|
Use For Each statement and try...
|
|
|
|
|
|
Looking for a free web service to verify names against social security numbers
-- modified at 12:31 Wednesday 31st January, 2007
|
|
|
|
|
You have to be kidding.
|
|
|
|
|
I didn't know that was a joke
If you need to verify a name what would you do?
|
|
|
|
|
So, you somehow believe that there is a service that will give you the SS# when a name is entered?
|
|
|
|
|
No Ed.
Provide both a name and SSN for a boolean match.
|
|
|
|
|
Again, don't you think this would be a huge security risk?
|
|
|
|
|
I have a My.BusinessLogicObjects.dll that I am updating on a server.
The file is in my bin folder and I have registerd it in COM+ and added it in C:\WINNT\assembly.
Noe when I open my web page and go to a page that uses this dll, I get this error message:
loadSubPage failed trying to load '~/My/Web/campaign.ascx'. Error loading latest campaign items. CoCreateInstance returned an unexpected type: expected My.BusinessLogicObjects.Product, received My.BusinessLogicObjects.Product. () : at My.Web.Catalog.Controls.Campaigns.campaignItems.listLatestCampaignItems() at My.Web.Catalog.Controls.Campaigns.campaign.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at My.Web.GUI.Controls.index.loadSubPage()
So it's asking for my old My.BusinessLogicObjects.dll
This is odd, since other pages that is new, and uses new methods that I have on the new My.BusinessLogicObjects.dll works fine.
This is what I have tryed:
- Moved My.BusinessLogicObjects.dll to another folder and registerd it from there, gave same result.
- Reinstalled the dot net framework 1.1, gave same result.
- Not registerd it on C:\WINNT\assembly, gave same result.
Does anyone had this problem before, or know how to fix this?
Please help
Thomas
|
|
|
|
|
Have you IIS restarted - if not - try to do it - it should unload all COM objects.
|
|
|
|
|
Ok, maybe third times a charm. I've posted about this problem before and thought I had an answer but it doesn't work for what I want. Is there anyway to programmatically I can remove the style Border-Collapse:Collapse before the table gets built and sent to the browser? Can I make a Sub that's called by the OnLoad of the DataList or some other On____? I was using javascript that ran on load but it's ugly and inefficient (also with the AJAX I'm using it doesnt always run) EX:
<script language='javascript'>document.getElementById('Calendar_DataList1').style.borderCollapse='';</script>
Thanks for any help
|
|
|
|
|
By design, the DataList control uses the TableStyle to apply the style for the control when it is rendered, and the tablestyle basically will emit the the Border-Collapse stuff when the CellSpacing is 0.So there are a couple of options to work around here:
+ Assign a value (gt&0) to the CellSpacing property of the control.
+ Define your own custom TabelStyle and override the CreateControlStyle method of the DataList control.
+ Override one of the methods called when the control is rendered like Render or RenderContents .... to get rid of the Border-Collapse.
|
|
|
|
|
Dear Professionals
I'm new to ASP.NET, Your help is appreciated!!!
I have 3 frames, leftFrame has menus, right frame should load the page corresponding to the menu i clicked in leftframe.
Can any one help with source code
NOTE: im using ASP.NET 1.1
Thanks and appreciations
|
|
|
|
|
What are you using for menus? You can access your frames from Javascript through the window.frames collection.
only two letters away from being an asset
|
|
|
|
|
Thanks 4 ur response
currently im using link buttons in menus but i dont know how to set code to load a page in right frame
|
|
|
|