473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Adding button in asp:repeater

I have <asp:repeater> with Item template:

<ItemTemplate>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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 4140
Simon,

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

Eliyahu

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

<ItemTemplate>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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:button>
<% else%>
<table><tR>.......
<%end if%>

Thank you,
Simon
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:u6**************@TK2MSFTNGP12.phx.gbl...
Simon,

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

Eliyahu

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

<ItemTemplate>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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><table bgcolor='white' width=100%><tr><td>" & dan & "</tD><td><input onclick='" & btnDelete.ClientID & ".click()' type='button' value='Delete'></td></tR><tr><td><ul>"

Thank you,

Simon

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:u6**************@TK2MSFTNGP12.phx.gbl...
Simon,

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

Eliyahu

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

<ItemTemplate>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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*********@stud-moderna.si> wrote in message news:%2******************@tk2msftngp13.phx.gbl...
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:button>
<% else%>
<table><tR>.......
<%end if%>

Thank you,
Simon
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:u6**************@TK2MSFTNGP12.phx.gbl...
Simon,

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

Eliyahu

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

<ItemTemplate>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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><%#DataBinder.Eval(Container.DataItem, "danIme")%></td>
</tr>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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.HtmlControls.HtmlTableRow

Where is the problem and how I can solve it?

Thank you,
Simon

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:uZ**************@TK2MSFTNGP15.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*********@stud-moderna.si> wrote in message news:%2******************@tk2msftngp13.phx.gbl...
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:button>
<% else%>
<table><tR>.......
<%end if%>

Thank you,
Simon
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:u6**************@TK2MSFTNGP12.phx.gbl...
Simon,

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

Eliyahu

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

<ItemTemplate>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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*********@stud-moderna.si> wrote in message news:uK***************@TK2MSFTNGP11.phx.gbl...
If I have:
<ItemTemplate>
<tr runat="server" id="trName">
<td><%#DataBinder.Eval(Container.DataItem, "danIme")%></td>
</tr>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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.HtmlControls.HtmlTableRow

Where is the problem and how I can solve it?

Thank you,
Simon

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:uZ**************@TK2MSFTNGP15.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*********@stud-moderna.si> wrote in message news:%2******************@tk2msftngp13.phx.gbl...
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:button>
<% else%>
<table><tR>.......
<%end if%>

Thank you,
Simon
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:u6**************@TK2MSFTNGP12.phx.gbl...
Simon,

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

Eliyahu

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

<ItemTemplate>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.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
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. ...
2
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...
5
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...
4
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 ...
1
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. ...
3
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: ...
3
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...
2
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"...
1
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...
0
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...

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.