473,511 Members | 16,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why can't I do this????

I keep getting the following error when trying to do the following!

'DataBinding' is not an event of 'System.Web.UI.WebControls.HyperLinkColumn'.

How do I get the value Name into the DataNavigateURLField??? I would really
appritiate any advice! Thanks

<asp:hyperlinkcolumn
DataNavigateUrlField='<%#Replace(Container.DataIte m.GetDirectoryEntry().Name,"CN=","")%>'
DataNavigateUrlFormatString="usrManDetails.aspx?id ={0}" Text="<img border=0
src=../images/edit.gif alt=Edit Page>">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:hyperlinkcolumn>
Nov 19 '05 #1
3 1358
Tim, the "canned" columns like hyperlinkcolumn and boundcolumn don't get
databound themselves. Instead, you specify just the field names from the
datasource on the datagrid. So, for DataNavigateUrlField just enter the field
name that corresponds to the {0} in your format string.

e.g. from the docs...
<Columns>
<asp:HyperLinkColumn
HeaderText="Select an Item"
DataNavigateUrlField="IntegerValue"
DataNavigateUrlFormatString="detailspage.aspx?id={ 0}"
DataTextField="PriceValue"
DataTextFormatString="{0:c}"
Target="_blank"/>
</Columns>

Or, skip the hyperlinkcolumn, create your own itemtemplate, and add your own
asp:hyperlink that you can databind to (I find this way easier and more
flexible than the canned choices).

Bill

"Tim::.." wrote:
I keep getting the following error when trying to do the following!

'DataBinding' is not an event of 'System.Web.UI.WebControls.HyperLinkColumn'.

How do I get the value Name into the DataNavigateURLField??? I would really
appritiate any advice! Thanks

<asp:hyperlinkcolumn
DataNavigateUrlField='<%#Replace(Container.DataIte m.GetDirectoryEntry().Name,"CN=","")%>'
DataNavigateUrlFormatString="usrManDetails.aspx?id ={0}" Text="<img border=0
src=../images/edit.gif alt=Edit Page>">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:hyperlinkcolumn>

Nov 19 '05 #2
Thanks Bill,

I have no problem when my datasource is a database or something similar it
is just when I use DirectoryServices

For some reason I cant get it to work...

Here is my databind!

Would really appritiate any help anyone can provide!

Thanks

...CODE
Sub GetUserADInfo()
Dim strUserName As String
Dim strADPath As String

strUserName = "netadmin" 'HttpContext.Current.User.Identity.Name
strADPath = "netdomain.usembassy.dk"
Dim Entry As DirectoryEntry = New DirectoryEntry("LDAP://" &
strADPath, "netadmin", "N3753rv3r0!")
' Create a DirectorySearcher object.
Dim mySearcher As New DirectorySearcher(Entry)
' Use the FindOne method to find the object, which in this case, is
the user
' indicated by User Name and assign it to a SearchResult.
mySearcher.Filter = ("(&(objectCategory=person)(objectClass=user))" )
'Dim MySearchResult As SearchResult = mySearcher.FindOne
Dim results As SearchResultCollection
results = mySearcher.FindAll()
dgADUserInfo.DataSource = results
dgADUserInfo.DataBind()

End Sub

"Bill Borg" wrote:
Tim, the "canned" columns like hyperlinkcolumn and boundcolumn don't get
databound themselves. Instead, you specify just the field names from the
datasource on the datagrid. So, for DataNavigateUrlField just enter the field
name that corresponds to the {0} in your format string.

e.g. from the docs...
<Columns>
<asp:HyperLinkColumn
HeaderText="Select an Item"
DataNavigateUrlField="IntegerValue"
DataNavigateUrlFormatString="detailspage.aspx?id={ 0}"
DataTextField="PriceValue"
DataTextFormatString="{0:c}"
Target="_blank"/>
</Columns>

Or, skip the hyperlinkcolumn, create your own itemtemplate, and add your own
asp:hyperlink that you can databind to (I find this way easier and more
flexible than the canned choices).

Bill

"Tim::.." wrote:
I keep getting the following error when trying to do the following!

'DataBinding' is not an event of 'System.Web.UI.WebControls.HyperLinkColumn'.

How do I get the value Name into the DataNavigateURLField??? I would really
appritiate any advice! Thanks

<asp:hyperlinkcolumn
DataNavigateUrlField='<%#Replace(Container.DataIte m.GetDirectoryEntry().Name,"CN=","")%>'
DataNavigateUrlFormatString="usrManDetails.aspx?id ={0}" Text="<img border=0
src=../images/edit.gif alt=Edit Page>">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:hyperlinkcolumn>

Nov 19 '05 #3
Regardless of datasource, you still can't do the databind (<%#...%>) in a
hyperlinkcolumn. DataNavigateUrlField needs the name of a public property of
the dataitem. I don't do much with AD, but in your case looks like each
dataitem is of type SearchResult, so DataNavigateUrlField should be a
property of that, e.g. "FileName", etc., and the framework will use
reflection to go get that value.

Also, this is among the reasons I gravitate toward the code-behind and
ItemDataBound--getting this straight in the html w/out intellisense, etc. is
pretty tedious.

Have fun.

Bill

"Tim::.." wrote:
Thanks Bill,

I have no problem when my datasource is a database or something similar it
is just when I use DirectoryServices

For some reason I cant get it to work...

Here is my databind!

Would really appritiate any help anyone can provide!

Thanks

..CODE
Sub GetUserADInfo()
Dim strUserName As String
Dim strADPath As String

strUserName = "netadmin" 'HttpContext.Current.User.Identity.Name
strADPath = "netdomain.usembassy.dk"
Dim Entry As DirectoryEntry = New DirectoryEntry("LDAP://" &
strADPath, "netadmin", "N3753rv3r0!")
' Create a DirectorySearcher object.
Dim mySearcher As New DirectorySearcher(Entry)
' Use the FindOne method to find the object, which in this case, is
the user
' indicated by User Name and assign it to a SearchResult.
mySearcher.Filter = ("(&(objectCategory=person)(objectClass=user))" )
'Dim MySearchResult As SearchResult = mySearcher.FindOne
Dim results As SearchResultCollection
results = mySearcher.FindAll()
dgADUserInfo.DataSource = results
dgADUserInfo.DataBind()

End Sub

"Bill Borg" wrote:
Tim, the "canned" columns like hyperlinkcolumn and boundcolumn don't get
databound themselves. Instead, you specify just the field names from the
datasource on the datagrid. So, for DataNavigateUrlField just enter the field
name that corresponds to the {0} in your format string.

e.g. from the docs...
<Columns>
<asp:HyperLinkColumn
HeaderText="Select an Item"
DataNavigateUrlField="IntegerValue"
DataNavigateUrlFormatString="detailspage.aspx?id={ 0}"
DataTextField="PriceValue"
DataTextFormatString="{0:c}"
Target="_blank"/>
</Columns>

Or, skip the hyperlinkcolumn, create your own itemtemplate, and add your own
asp:hyperlink that you can databind to (I find this way easier and more
flexible than the canned choices).

Bill

"Tim::.." wrote:
I keep getting the following error when trying to do the following!

'DataBinding' is not an event of 'System.Web.UI.WebControls.HyperLinkColumn'.

How do I get the value Name into the DataNavigateURLField??? I would really
appritiate any advice! Thanks

<asp:hyperlinkcolumn
DataNavigateUrlField='<%#Replace(Container.DataIte m.GetDirectoryEntry().Name,"CN=","")%>'
DataNavigateUrlFormatString="usrManDetails.aspx?id ={0}" Text="<img border=0
src=../images/edit.gif alt=Edit Page>">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:hyperlinkcolumn>

Nov 19 '05 #4

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

Similar topics

0
2815
by: AK | last post by:
Hi all, I have a form which simulates a form collecting a person's info for a job. The form has the field's like fname, lname, address etc. The last field in the form is browse for resume and...
1
3670
by: farzad | last post by:
Hi I try to install php_ming.so in my php . I am using Redhat 8.0 php 4.2.2 apache 2.0.4. I am doing as the howto install file want me to do. as follow....
1
3138
by: Randell D. | last post by:
Folks, I use Apache/PHP with Webazlier to view the log files. I get a number of user agents (web browsers?) that visit the website - For example: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT...
2
2134
by: Alex | last post by:
Is it more time-consuming to troubleshoot or just start from scratch. PHP used to work that's why I'm tempted to just re-install Linux.
0
1954
by: @(none).dk | last post by:
Hi I am not sure whether my new webhotel has setup "AddType jad/jar files" in the apache configuration file. The webhotel has php - so my question is: Can I make something with php that...
3
4214
by: lawrence | last post by:
I do get that MD5() scrambles a password, but how do you then unscrable it? I want to get $password from the user, scrable it, then append it to every link.
8
2489
by: Jeffrey Silverman | last post by:
'nuff said. Just venting... -- Jeffrey D. Silverman | jeffrey AT jhu DOT edu Johns Hopkins University | Baltimore, MD Website | http://www.wse.jhu.edu/newtnotes/
5
2745
by: paul13 | last post by:
This seems weird, but when I use the following code, include 'http://www.foo.com/includes.php'; includedfunction(); I am told that it is a call to an undefined function, but...
2
30226
by: tobias | last post by:
I am new in programming with PHP. I wrote the following code: file name: output.php <?php echo $texto; ?> And I call it on my browser like: http://localhost/cgt/output.php?texto=testing
3
4032
by: lawrence | last post by:
I haven't been able to reach www.php.net for days. Most of the rest of the web is working for me, though I've bad trouble reaching any English sites. Anyone else having trouble?
0
7242
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,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
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...
1
7081
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...
0
7510
tracyyun
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...
1
5066
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...
0
4737
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...
0
3225
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...

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.