473,670 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding button in asp:repeater

I have <asp:repeater > with Item template:

<ItemTemplate >
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

In my function writeLine, I would like to add in some cases, <asp:button>
Protected Function writeLine(ByVal dayName As String, ByVal timeS As String) As String

If dayName="Friday " then
writeLine="<asp :button> + some HTML sintaks"
else
writeLine = "some html sintaks"
end if

End Function
How can I do that?

Thank you,
Simon
Nov 18 '05 #1
6 4154
Simon,

On databinding stage you can't add any server controls programmaticall y. You rather should include everything in the template and manipulate visibility settings.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:u3******** ******@TK2MSFTN GP15.phx.gbl...
I have <asp:repeater > with Item template:

<ItemTemplate >
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

In my function writeLine, I would like to add in some cases, <asp:button>
Protected Function writeLine(ByVal dayName As String, ByVal timeS As String) As String

If dayName="Friday " then
writeLine="<asp :button> + some HTML sintaks"
else
writeLine = "some html sintaks"
end if

End Function
How can I do that?

Thank you,
Simon
Nov 18 '05 #2
Can I have some if statements in my template, like I have them into my write functions.

For example:
<itemTemplate >
<%IF danIme=dayOld then%>
<tr><td><asp:bu tton>
<% else%>
<table><tR>.... ...
<%end if%>

Thank you,
Simon
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:u6******** ******@TK2MSFTN GP12.phx.gbl...
Simon,

On databinding stage you can't add any server controls programmaticall y. You rather should include everything in the template and manipulate visibility settings.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:u3******** ******@TK2MSFTN GP15.phx.gbl...
I have <asp:repeater > with Item template:

<ItemTemplate >
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

In my function writeLine, I would like to add in some cases, <asp:button>
Protected Function writeLine(ByVal dayName As String, ByVal timeS As String) As String

If dayName="Friday " then
writeLine="<asp :button> + some HTML sintaks"
else
writeLine = "some html sintaks"
end if

End Function
How can I do that?

Thank you,
Simon
Nov 18 '05 #3
Why I can't use in my function writeLine, which is in my ItemTemplate, some other control clientID property?

Is there some other way?

writeLine = "</td></tr><tr><td><tab le bgcolor='white' width=100%><tr> <td>" & dan & "</tD><td><input onclick='" & btnDelete.Clien tID & ".click()' type='button' value='Delete'> </td></tR><tr><td><ul> "

Thank you,

Simon

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:u6******** ******@TK2MSFTN GP12.phx.gbl...
Simon,

On databinding stage you can't add any server controls programmaticall y. You rather should include everything in the template and manipulate visibility settings.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:u3******** ******@TK2MSFTN GP15.phx.gbl...
I have <asp:repeater > with Item template:

<ItemTemplate >
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

In my function writeLine, I would like to add in some cases, <asp:button>
Protected Function writeLine(ByVal dayName As String, ByVal timeS As String) As String

If dayName="Friday " then
writeLine="<asp :button> + some HTML sintaks"
else
writeLine = "some html sintaks"
end if

End Function
How can I do that?

Thank you,
Simon
Nov 18 '05 #4
No. The point is that server components need compilation and it happens before databinding. Put all server controls in the template and than set Visible=false in the code-behind or databind Visible property in the ..aspx file. A server control with Visible=false won't be rendered to the client, exactly what you want if I understand you correctly.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:%2******** **********@tk2m sftngp13.phx.gb l...
Can I have some if statements in my template, like I have them into my write functions.

For example:
<itemTemplate >
<%IF danIme=dayOld then%>
<tr><td><asp:bu tton>
<% else%>
<table><tR>.... ...
<%end if%>

Thank you,
Simon
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:u6******** ******@TK2MSFTN GP12.phx.gbl...
Simon,

On databinding stage you can't add any server controls programmaticall y. You rather should include everything in the template and manipulate visibility settings.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:u3******** ******@TK2MSFTN GP15.phx.gbl...
I have <asp:repeater > with Item template:

<ItemTemplate >
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

In my function writeLine, I would like to add in some cases, <asp:button>
Protected Function writeLine(ByVal dayName As String, ByVal timeS As String) As String

If dayName="Friday " then
writeLine="<asp :button> + some HTML sintaks"
else
writeLine = "some html sintaks"
end if

End Function
How can I do that?

Thank you,
Simon
Nov 18 '05 #5
If I have:
<ItemTemplate >
<tr runat="server" id="trName">
<td><%#DataBind er.Eval(Contain er.DataItem, "danIme")%> </td>
</tr>
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

AND then in writeLine function I would like to set the visible property of my row:
trName.Visible = False

I get an error message: Not set to the instance of the object.

In page I have declared:
Protected WithEvents trName As System.Web.UI.H tmlControls.Htm lTableRow

Where is the problem and how I can solve it?

Thank you,
Simon

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:uZ******** ******@TK2MSFTN GP15.phx.gbl...
No. The point is that server components need compilation and it happens before databinding. Put all server controls in the template and than set Visible=false in the code-behind or databind Visible property in the ..aspx file. A server control with Visible=false won't be rendered to the client, exactly what you want if I understand you correctly.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:%2******** **********@tk2m sftngp13.phx.gb l...
Can I have some if statements in my template, like I have them into my write functions.

For example:
<itemTemplate >
<%IF danIme=dayOld then%>
<tr><td><asp:bu tton>
<% else%>
<table><tR>.... ...
<%end if%>

Thank you,
Simon
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:u6******** ******@TK2MSFTN GP12.phx.gbl...
Simon,

On databinding stage you can't add any server controls programmaticall y. You rather should include everything in the template and manipulate visibility settings.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:u3******** ******@TK2MSFTN GP15.phx.gbl...
I have <asp:repeater > with Item template:

<ItemTemplate >
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

In my function writeLine, I would like to add in some cases, <asp:button>
Protected Function writeLine(ByVal dayName As String, ByVal timeS As String) As String
If dayName="Friday " then
writeLine="<asp :button> + some HTML sintaks"
else
writeLine = "some html sintaks"
end if
End Function

How can I do that?

Thank you,
Simon

Nov 18 '05 #6
Simon,

Are you sure you are on the right track? What us your task? Looks, like you are trying to build a table in a repeater? What does writeLine do? Trying to write an html for the table row?

May be you should rather re-design to using normal datagrid with templates built in a regular way?

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:uK******** *******@TK2MSFT NGP11.phx.gbl.. .
If I have:
<ItemTemplate >
<tr runat="server" id="trName">
<td><%#DataBind er.Eval(Contain er.DataItem, "danIme")%> </td>
</tr>
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

AND then in writeLine function I would like to set the visible property of my row:
trName.Visible = False

I get an error message: Not set to the instance of the object.

In page I have declared:
Protected WithEvents trName As System.Web.UI.H tmlControls.Htm lTableRow

Where is the problem and how I can solve it?

Thank you,
Simon

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:uZ******** ******@TK2MSFTN GP15.phx.gbl...
No. The point is that server components need compilation and it happens before databinding. Put all server controls in the template and than set Visible=false in the code-behind or databind Visible property in the .aspx file. A server control with Visible=false won't be rendered to the client, exactly what you want if I understand you correctly.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:%2******** **********@tk2m sftngp13.phx.gb l...
Can I have some if statements in my template, like I have them into my write functions.

For example:
<itemTemplate >
<%IF danIme=dayOld then%>
<tr><td><asp:bu tton>
<% else%>
<table><tR>.... ...
<%end if%>

Thank you,
Simon
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:u6******** ******@TK2MSFTN GP12.phx.gbl...
Simon,

On databinding stage you can't add any server controls programmaticall y. You rather should include everything in the template and manipulate visibility settings.

Eliyahu

"simon" <si*********@st ud-moderna.si> wrote in message news:u3******** ******@TK2MSFTN GP15.phx.gbl...
I have <asp:repeater > with Item template:

<ItemTemplate >
<%# writeLine(DataB inder.Eval(Cont ainer.DataItem, "danIme"),DataB inder.Eval(Cont ainer.DataItem, "timeStart" ))%>
</ItemTemplate>

In my function writeLine, I would like to add in some cases, <asp:button>
Protected Function writeLine(ByVal dayName As String, ByVal timeS As String) As String
If dayName="Friday " then
writeLine="<asp :button> + some HTML sintaks"
else
writeLine = "some html sintaks"
end if
End Function

How can I do that?

Thank you,
Simon

Nov 18 '05 #7

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

Similar topics

1
1735
by: Keith Harris | last post by:
Hi, I have a Repeater control which is bound to a dataset. In the footer of the repeater control, I have a Button whose visibility I want to vary according to the sum of a column being > 0. I have tried to set the button's visibility in Page_Load (after data binding), but I get a NullReferenceException stating that "Object reference not set to an instance of an object".
2
3805
by: Peter Kirk | last post by:
Hi are there any "gotchas" with using an asp:repeater that means that the "onclick" method of a LinkButton created in the repaeter does not fire? I at least cannot get it to work. I have a webpage where the user can enter some search criteria (via dropdowns and textboxes) and then perform a search and have results presented. The results list includes linkbuttons which the user can click on to obtain more detailed results.
5
8256
by: Scott Lyon | last post by:
I am having a strange problem. The program is a bit complex, but I'll try to simplify what I can. I apologize if this is complicated, but I think this would still be simpler than posting a bunch of source code. If you want me to post code, though, just say so. In a nutshell, I've got an ASP.NET application that has one main ASPX page. On that ASPX page, it has a user control (an ASCX) that displays the actual data and controls I need.
4
3636
by: Eric | last post by:
Hello, I have the following dataset that I want to bind to a repeater to be displayed as a table. Owner Animal Volume --------------------------- Eric Dog 6 Eric Cat 3 Eric Gerbil 1 Eric Bird 10
1
2926
by: Keith Harris | last post by:
Hi, I have a Repeater control which is bound to a dataset. In the footer of the repeater control, I have a Button whose visibility I want to vary according to the sum of a column being > 0. I have tried to set the button's visibility in Page_Load (after data binding), but I get a NullReferenceException stating that "Object reference not set to an instance of an object".
3
8584
by: Eskimo | last post by:
how do I add a linkbutton or asp:button to a datarepeater and fire an event? I am using this as my example code: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwebservercontroltemplatesdynamically.asp -- tym, Eskimo
3
4148
by: Shimon Sim | last post by:
I put linkbutton in a repeater header. I attached event handler in makeup as onclick="btnSort_Click". Made btnSort_Click method public. It doesn't fire if I click on it. I tried to attach it in ItemDataBound event but I think it is too late. What am I doing wrong? Thanks Shimon.
2
3876
by: bissatch | last post by:
Hi, I am trying to output a list of checkboxes. Using ASP .NET controls, I was able to create the following: <label for="colour_red">Red: </label><asp:CheckBox ID="colour_red" runat="server" /><br /> <label... <label... <label...
1
8050
by: semomaniz | last post by:
I have a button inside a repeater which is supposed to open a popup when clicked. But when i click on the button my modalpopup does not open. The strange thing is on the code provided below if i replace the button with linkbutton every thing works fine and I have my popup dispalying. Is there a reason for the buttons to not function inside the repeater? <asp:Repeater ID="myrep" runat="server" OnItemCommand="myrep_ItemCommand">...
0
8469
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
8386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8903
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...
0
8814
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
8592
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,...
1
6213
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
5684
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
4391
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1794
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.