473,796 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pb with skinID in templated columns having DataBinder.Eval

WT
Hello,

I have a usercontrol loaded in a page with a theme.

This usercontrol contains columns template with hyperlinks, with skinID.

The columns are not displayed, seems thta there is some not traceable
exception triggered and the all binding is stopped.

But this same named skinid is working for hyperlinks outside templates.

Is it a knwn problem ?

Thanks for help.

CS

Here is a sample of my code:

<asp:datagrid id="myDataGrid " runat="server" width="100%"
AutoGenerateCol umns="False" EnableViewState ="False" AllowSorting="T rue">
<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:HyperLin k Text="<%$ Resources:Resou rcesGen,EDIT %>"
SkinID="editHyp erLink" NavigateUrl='<% #
BuildUrl(Config .ModulesPath+"/Cont/ContEdit.aspx", PageNum,"ItemNu m=" +
DataBinder.Eval (Container.Data Item,"ItemNum") )%>' Visible='<%# IsEditable
%>' runat="server" />
</ItemTemplate>
</asp:TemplateCol umn>


May 18 '07 #1
14 2021
WT
More on this subject, stillno solution: on the first display ( PostBack
false) the datagridrows are not display, but on the postback due to a change
in the sort column, miracle ! everything is displayed !
In complement I add that viewstate is off for the Grid and that in the
Page_Load event (set with a delegate in OnInit, and autoevenetwireu p=false)
is always binding the datagrid from the DB.
Onlychange is thta the sort event generates a seconjd binding ? Should I
bind twice when postback==false ?

I can't ask my users to do a postback :) ?
What could be the reason ?

Thanks for help.
"WT" <WT@newsgroups. nospama écrit dans le message de news:
ua************* *@TK2MSFTNGP04. phx.gbl...
Hello,

I have a usercontrol loaded in a page with a theme.

This usercontrol contains columns template with hyperlinks, with skinID.

The columns are not displayed, seems thta there is some not traceable
exception triggered and the all binding is stopped.

But this same named skinid is working for hyperlinks outside templates.

Is it a knwn problem ?

Thanks for help.

CS

Here is a sample of my code:

<asp:datagrid id="myDataGrid " runat="server" width="100%"
AutoGenerateCol umns="False" EnableViewState ="False" AllowSorting="T rue">
<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:HyperLin k Text="<%$ Resources:Resou rcesGen,EDIT %>"
SkinID="editHyp erLink" NavigateUrl='<% #
BuildUrl(Config .ModulesPath+"/Cont/ContEdit.aspx", PageNum,"ItemNu m=" +
DataBinder.Eval (Container.Data Item,"ItemNum") )%>' Visible='<%# IsEditable
%>' runat="server" />
</ItemTemplate>
</asp:TemplateCol umn>


May 19 '07 #2
Hi CS,

For such issue, I hope you understand that without complete reproducible
code or project, there's really not much I can do here to point out the
root cause. Therefore, would you please post more complete code here for
reference? Thank you.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

May 21 '07 #3
WT
Here is a small sample of a user control containing a datalist with
templated items, codebehind follow., and skin file
When the skinid is present, nothing is displayed, when removed, it is Ok.
<%@ Control language="c#" AutoEventWireup ="false" Inherits="FAQs"
Codebehind="FAQ s.ascx.cs" %>

<%@ Import Namespace="Addo n.Core" %>

<%@ Import Namespace="Addo n.Settings" %>

<asp:datalist ID="myDataList " runat="server">

<SelectedItemSt yle BackColor="Gain sboro"></SelectedItemSty le>

<ItemTemplate >

<asp:HyperLin k ID=HyperlinkIte m Text="<%$ Resources:Resou rcesWTCRM,EDIT %>"
runat="server" NavigateUrl='<% # BuildUrl("/FAQsEdit.aspx", "ItemID=" +
DataBinder.Eval (Container.Data Item,"ItemID") )%>' Visible="<%# IsEditable
%>" />

<SPAN class="normalBo ld"><asp:Litera l text="<%$
Resources:Resou rcesWTCRM,FAQ_Q %>" ID="Literal3"
runat="server"> </asp:Literal>:&n bsp;</SPAN>

<asp:LinkButt on ID=LinkbuttonIt em runat="server" CausesValidatio n="False"
CommandName="se lect" Text='<%# DataBinder.Eval (Container.Data Item,
"Question") %>' title='<%# DataBinder.Eval (Container.Data Item,
"CreatedDat e") %>'>

</asp:LinkButton>

</ItemTemplate>

</asp:datalist>

/// <summary>

-----------------------------------------------------------------------------------------------

/// IBS Portal FAQ module

/// </summary>

public partial class FAQs : UserControl

{

protected void Page_Load(objec t sender, System.EventArg s e){
BindData();}

private void BindData(){
FAQsDB questions = new FAQsDB();
try{
myDataList.Data Source = questions.GetFA QsGlobalized(Mo duleID);
myDataList.Data Bind();
}
catch(Exception ex)
{
System.Diagnost ics.Trace.Write LineIf(ModuleTr aceSwitch.Sw.Tr aceError,string .Format("FAQs
BindData ex : {0}",ex));
}
}


#region Web Form Designer generated code

override protected void OnInit(EventArg s e)

{

InitializeCompo nent();

base.OnInit(e);

}
/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeCompo nent()

{

this.Load += new EventHandler(Pa ge_Load);

}

#endregion

-------------------- named skin in skin file
<asp:HyperLin k SkinId="editHyp erLink" ImageUrl="img/WT_Edit.gif"
runat="server" />
CS
"Walter Wang [MSFT]" <wa****@online. microsoft.coma écrit dans le message
de news: Wp************* *@TK2MSFTNGHUB0 2.phx.gbl...
Hi CS,

For such issue, I hope you understand that without complete reproducible
code or project, there's really not much I can do here to point out the
root cause. Therefore, would you please post more complete code here for
reference? Thank you.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

May 22 '07 #4
WT
Sorry I sent the version Ok, just replace the hyperlink with same id by
<asp:HyperLin k ID=HyperlinkIte m SkinID="editHyp erLink" Text="<%$
Resources:Resou rcesWTCRM,EDIT %>" .../>

"WT" <WT@newsgroups. nospama écrit dans le message de news:
%2************* ***@TK2MSFTNGP0 4.phx.gbl...
Here is a small sample of a user control containing a datalist with
templated items, codebehind follow., and skin file
When the skinid is present, nothing is displayed, when removed, it is Ok.
<%@ Control language="c#" AutoEventWireup ="false" Inherits="FAQs"
Codebehind="FAQ s.ascx.cs" %>

<%@ Import Namespace="Addo n.Core" %>

<%@ Import Namespace="Addo n.Settings" %>

<asp:datalist ID="myDataList " runat="server">

<SelectedItemSt yle BackColor="Gain sboro"></SelectedItemSty le>

<ItemTemplate >

<asp:HyperLin k ID=HyperlinkIte m Text="<%$ Resources:Resou rcesWTCRM,EDIT
%>" runat="server" NavigateUrl='<% # BuildUrl("/FAQsEdit.aspx", "ItemID=" +
DataBinder.Eval (Container.Data Item,"ItemID") )%>' Visible="<%# IsEditable
%>" />

<SPAN class="normalBo ld"><asp:Litera l text="<%$
Resources:Resou rcesWTCRM,FAQ_Q %>" ID="Literal3"
runat="server"> </asp:Literal>:&n bsp;</SPAN>

<asp:LinkButt on ID=LinkbuttonIt em runat="server" CausesValidatio n="False"
CommandName="se lect" Text='<%# DataBinder.Eval (Container.Data Item,
"Question") %>' title='<%# DataBinder.Eval (Container.Data Item,
"CreatedDat e") %>'>

</asp:LinkButton>

</ItemTemplate>

</asp:datalist>

/// <summary>

-----------------------------------------------------------------------------------------------

/// IBS Portal FAQ module

/// </summary>

public partial class FAQs : UserControl

{

protected void Page_Load(objec t sender, System.EventArg s e){
BindData();}

private void BindData(){
FAQsDB questions = new FAQsDB();
try{
myDataList.Data Source = questions.GetFA QsGlobalized(Mo duleID);
myDataList.Data Bind();
}
catch(Exception ex)
{
System.Diagnost ics.Trace.Write LineIf(ModuleTr aceSwitch.Sw.Tr aceError,string .Format("FAQs
BindData ex : {0}",ex));
}
}


#region Web Form Designer generated code

override protected void OnInit(EventArg s e)

{

InitializeCompo nent();

base.OnInit(e);

}
/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeCompo nent()

{

this.Load += new EventHandler(Pa ge_Load);

}

#endregion

-------------------- named skin in skin file
<asp:HyperLin k SkinId="editHyp erLink" ImageUrl="img/WT_Edit.gif"
runat="server" />
CS
"Walter Wang [MSFT]" <wa****@online. microsoft.coma écrit dans le message
de news: Wp************* *@TK2MSFTNGHUB0 2.phx.gbl...
>Hi CS,

For such issue, I hope you understand that without complete reproducible
code or project, there's really not much I can do here to point out the
root cause. Therefore, would you please post more complete code here for
reference? Thank you.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

============== =============== =============== ======
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============== =============== =============== ======

This posting is provided "AS IS" with no warranties, and confers no
rights.


May 22 '07 #5
Hi CS,

I can see your BindData has a try/catch block, check if there's any
exception when first loaded.

Here's my test code that works fine on my side:

<%@ Import namespace="Syst em.Data"%>
<%@ Control Language="C#" ClassName="WebU serControl" %>

<script runat="server">
private string BuildUrl(string url, string qs)
{
return url + "?" + qs;
}
private bool IsEditable
{
get { return true; }
}

protected void Page_Load(objec t sender, EventArgs e)
{
myDataList.Data Source = GetDataTable();
myDataList.Data Bind();
}

DataTable GetDataTable()
{
DataTable dt = new DataTable();
dt.Columns.Add( "ItemID", typeof(int));
dt.Columns.Add( "Question") ;
dt.Columns.Add( "CreatedDat e", typeof(DateTime ));

for (int i = 0; i < 10; i++)
{
dt.Rows.Add(i, "question " + i, DateTime.Now);
}
return dt;
}

</script>

<asp:DataList ID="myDataList " runat="server">
<SelectedItemSt yle BackColor="Gain sboro"></SelectedItemSty le>
<ItemTemplate >
<asp:HyperLin k SkinID="editHyp erLink" ID="HyperlinkIt em"
Text="Edit" runat="server" NavigateUrl='<% #
BuildUrl("/FAQsEdit.aspx", "ItemID=" +
DataBinder.Eval (Container.Data Item,"ItemID") )%>'
Visible="<%# IsEditable %>" />
<span class="normalBo ld">
<asp:Literal Text="FAQ" ID="Literal3"
runat="server"> </asp:Literal>:&n bsp;</span>
<asp:LinkButt on ID="LinkbuttonI tem" runat="server"
CausesValidatio n="False" CommandName="se lect"
Text='<%# DataBinder.Eval (Container.Data Item, "Question") %>'
title='<%# DataBinder.Eval (Container.Data Item, "CreatedDat e") %>'>

</asp:LinkButton>
</ItemTemplate>
</asp:DataList>


Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

May 23 '07 #6
Hi CS,

Please feel free to let me know if there's anything else I can help.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

May 28 '07 #7
WT
Hi Walter,

I still have the problem, but I amshort in time and must freeze it for 1
week.
Anyway thanks for help.
CS

"Walter Wang [MSFT]" <wa****@online. microsoft.coma écrit dans le message
de news: Ik************* ***@TK2MSFTNGHU B02.phx.gbl...
Hi CS,

Please feel free to let me know if there's anything else I can help.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

May 28 '07 #8
WT
Hello Walter,

We are back on this problem, we have found a workaround replacing the
hyperlink with an ImageButton: everything works.

But for mind peace I would appreciate to understand where is the pb with
hyperlink.

Thnaks for help
CS
"Walter Wang [MSFT]" <wa****@online. microsoft.coma écrit dans le message
de news: Ik************* ***@TK2MSFTNGHU B02.phx.gbl...
Hi CS,

Please feel free to let me know if there's anything else I can help.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jun 18 '07 #9
Hi CS,

Thanks for the update. Do you have a reproducible project to show the
problem of the ImageButton? Thanks.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 19 '07 #10

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

Similar topics

3
1463
by: Jim | last post by:
My subject probably isn't very descriptive of what I want to do, so let me explain: I wna tto have a website that holds a number of products, grouped by category. On the administration page of the website, I want to allow the operator to move products between categories. The interface I have in mind would have two dropdowns at the top, one to select the FROM categroy, which would cause the page to re-post, and thus display all of the...
4
5408
by: | last post by:
I have a datagrid with a template column that has a hyperlink and a label. The hyperlink text is bound to Title from my dataset and the label text is bound to Author in the dataset. The grid displays with the template columns showing the Title and the Author from the first row in all rows. The other none template columns are fine. Obviously I am not understanding something here. What am I missing????? -- Barry Fitzgerald
2
4554
by: Nicole | last post by:
I am creating template columns programmatically. I have read the msdn article on this and I'm so close. Article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchcreatingwebservercontroltemplatesprogrammatically.asp I have narrowed down the problem comes in when the _DataBinding handler is called and the literal text is being assigned, but I can't figure out beyond that. The main problem is that...
2
2114
by: | last post by:
Hello All, I am having a lot of difficulty trying to bind a templated column, that is programmatically created for a datagrid, to a datasource column. I have a datasource containing 2 columns, ID and VALUE. I would like to create a templated column in the datagrid that is bound to the VALUE column of the datasource.
1
1129
by: André Almeida Maldonado | last post by:
Hy Guys.. I have a datagrid with template columns. The datagrid have a datatable datasource. But when I try to bind data, I receive this error: DataBinder.Eval: 'System.Web.UI.WebControls.DataGridItem' do not have a property named "Codigo". See my code:
10
1986
by: DBLWizard | last post by:
Howdy, I need to compine two columns (LastName, Firstname) with the comma. The only problem I have is the Firstname could be blank and in that case I don't want the "," appended to the last name. This data is coming out of a Sql Server data base. I am currently using a DataReader and simply binding it to a data grid to display the information.
2
1261
by: Shafia | last post by:
Hi, My GridView has templated controls in it and I'm binding to an ObjectDataSource. The problem is it refused to bind to my grid column "ColumnName" which is also an UpdateCommand Parameter for the ObjectDataSource. It displays the following error "DataBinding: 'System.String' does not contain a property with the name 'ColumnName'. I've also cheched it with FormView and that is not binding either. same error.
2
3552
by: mikepolitowski | last post by:
Hi folks, I am have been trying to solve this problem for quite some time now and would appreciate any advice. I have been trying to call a code-behind function that is defined in my aspx.cs from within a DataList <ItemTemplate> block using the <%# %> syntax. I would not have written here if I had not spent over 6 hours trying to find a solution to this problem again any advice is greatly appreciated. I have included a code snippet...
1
2123
by: Brett Wesoloski | last post by:
I am new to using template columns. I am just trying to create a data grid with a bound column and another column with a imagebutton in it. What I have always done in the past was to then create a datatable and bind that to the datagrid. Where is my code to bind the grid to the datatable. DataTable dt = new DataTable(); dt.Columns.Add("FundDescription");
0
10461
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10190
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
10019
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 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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7555
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
6796
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
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
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.