Hello All,
I display a list of entries with a checkbox against them using a
repeater control bound to a database table. Based on the value of database
table I want to either show the checkbox for a row or not to show, how do I
accomplish that using a repeater control ?
Should I do something like this
<%if (((DataRowView) Container.DataI tem)["bThisUserHasIt "] == 0)
{ %><asp:CheckBo x ID="chkBookMark ID" text='<%#
((DataRowView)C ontainer.DataIt em)["nBookMarkI D"] %>' runat="server"
ForeColor="Whit e" Font-Size="1px" /<%} %>
(this one does not work , but I am thinking it might be possible to do it
like that, get this error, Error 2 The name 'Container' does not exist in
the current context
C:\Inetpub\wwwr oot\allenandove ry\bookmarks\re centbookmarks.a spx 24 35
C:\...\allenand overy\
)
or is there a better way to do it, checking and specifying the value in code
behind?
Thanks a lot for your support.
Imran. 3 2738
You can move the same code to simple function to determin if the check box
will be visible or not
<asp:CheckBox Visible='<%#Vis ibleYesNo(DataB inder.Eval(Cont ainer.DataItem,
"bThisUserHasIt ").ToString())% >' ID="chk" Runat="server"> </asp:CheckBox>
Please note the
Visible='<%#Vis ibleYesNo(DataB inder.Eval (Container.Data Item,
"bThisUserHasIt ").ToString())% >'
the VisibleYesNo funtion would look like
protected bool VisibleYesNo (string val)
{
if(val=="0")
return(true);
return(false);
}
"Imran Aziz" wrote: Hello All, I display a list of entries with a checkbox against them using a repeater control bound to a database table. Based on the value of database table I want to either show the checkbox for a row or not to show, how do I accomplish that using a repeater control ? Should I do something like this
<%if (((DataRowView) Container.DataI tem)["bThisUserHasIt "] == 0)
{ %><asp:CheckBo x ID="chkBookMark ID" text='<%# ((DataRowView)C ontainer.DataIt em)["nBookMarkI D"] %>' runat="server" ForeColor="Whit e" Font-Size="1px" /<%} %>
(this one does not work , but I am thinking it might be possible to do it like that, get this error, Error 2 The name 'Container' does not exist in the current context C:\Inetpub\wwwr oot\allenandove ry\bookmarks\re centbookmarks.a spx 24 35 C:\...\allenand overy\ )
or is there a better way to do it, checking and specifying the value in code behind?
Thanks a lot for your support. Imran.
You could make use of the Finbyvalue method and loop through the checkboxes.
Or create a function VisibleYesorNo function as adviced.
Patrick
"Imran Aziz" <im***@tb2.ne t> wrote in message
news:eV******** ******@tk2msftn gp13.phx.gbl... Hello All, I display a list of entries with a checkbox against them using a repeater control bound to a database table. Based on the value of database table I want to either show the checkbox for a row or not to show, how do
I accomplish that using a repeater control ? Should I do something like this
<%if (((DataRowView) Container.DataI tem)["bThisUserHasIt "] == 0)
{ %><asp:CheckBo x ID="chkBookMark ID" text='<%# ((DataRowView)C ontainer.DataIt em)["nBookMarkI D"] %>' runat="server" ForeColor="Whit e" Font-Size="1px" /<%} %>
(this one does not work , but I am thinking it might be possible to do it like that, get this error, Error 2 The name 'Container' does not exist in the current context C:\Inetpub\wwwr oot\allenandove ry\bookmarks\re centbookmarks.a spx 24 35 C:\...\allenand overy\ )
or is there a better way to do it, checking and specifying the value in
code behind?
Thanks a lot for your support. Imran.
Wonderful thanks a lot that worked great.
Imran
"Sreejith Ram" <Sr*********@di scussions.micro soft.com> wrote in message
news:4C******** *************** ***********@mic rosoft.com... You can move the same code to simple function to determin if the check box will be visible or not
<asp:CheckBox Visible='<%#Vis ibleYesNo(DataB inder.Eval(Cont ainer.DataItem, "bThisUserHasIt ").ToString())% >' ID="chk" Runat="server"> </asp:CheckBox>
Please note the
Visible='<%#Vis ibleYesNo(DataB inder.Eval (Container.Data Item, "bThisUserHasIt ").ToString())% >'
the VisibleYesNo funtion would look like
protected bool VisibleYesNo (string val) { if(val=="0") return(true);
return(false); } "Imran Aziz" wrote:
Hello All, I display a list of entries with a checkbox against them using a repeater control bound to a database table. Based on the value of database table I want to either show the checkbox for a row or not to show, how do I accomplish that using a repeater control ? Should I do something like this
<%if (((DataRowView) Container.DataI tem)["bThisUserHasIt "] == 0)
{ %><asp:CheckBo x ID="chkBookMark ID" text='<%# ((DataRowView)C ontainer.DataIt em)["nBookMarkI D"] %>' runat="server" ForeColor="Whit e" Font-Size="1px" /<%} %>
(this one does not work , but I am thinking it might be possible to do it like that, get this error, Error 2 The name 'Container' does not exist in the current context C:\Inetpub\wwwr oot\allenandove ry\bookmarks\re centbookmarks.a spx 24 35 C:\...\allenand overy\ )
or is there a better way to do it, checking and specifying the value in code behind?
Thanks a lot for your support. Imran. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jim French |
last post by:
I have a page that takes a comma delimited string and needs to bind to a
Repeater control. The string is split into an Array, and each value is put
into a DataBase query via a For Each loop. The purpose is to retrieve
address information for the user. Sometimes, the address_fk field in the
people table is null, so there will be no linking address information. In
this case, the section to be displayed asks if the user would like to create...
|
by: Alan Silver |
last post by:
Hello,
I have a form that contains a repeater. A simplified version of the
ItemTemplate is shown below (air code)...
<br><asp:Literal id="litID" runat="server" />
<br><asp:TextBox id="txtQty" runat="server" />
<hr>
This basically shows a list of item IDs, with quantities for each one.
|
by: sck10 |
last post by:
Hello,
I have a repeater that is bound to a SQL Server table. I would like to
place a summary in the footer for the item count and product cost.
I have two fields. One for the product name and the other for product
cost.
<%#Container.DataItem("ProductA")%>
<%#Container.DataItem("PriceA")%>
|
by: Jaybuffet |
last post by:
my aspx has something like this
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>'
showItem="true"/>
</ItemTemplate>
/asp:Repeater>
The DataSource for this Repeater is a CollectionBase of objects and is
|
by: Marc Llenas |
last post by:
Hi there,
I have a repeater that returns x rows from a main table.
I need to display some info stored on a secondary table that is linked to
the main using a one-to-many relationship.
Instead of using a nested repeater, I would like to manually do some checks
and display (or not) info contained on the secondary table.
| |
by: erin.sebastian |
last post by:
Hello All,
I have created a web page. At the top of the page there are 4 links;
upon clicking on one of the links it brings up the left hand side menu,
it's a repeater that loops through items selected from the database
based on the id of the link chosen from the link at the top of the
page. The page that displays the information is the same page for each
menu item as the details are stored in the database and selected based
on the id...
|
by: Sully |
last post by:
Hi Everyone,
I am pretty new to coding in .net and need some help in showing and
hiding information from a repeater control. I am calling a list of
FAQ's from a Database and display both the question and answer. What i
would like to happen is to display the list of questions and when the
user clicks on one of them, the answer appears below.
There are about 50 or so FAQ's, so I don't really want to use the
Javascript of Show/Hide div's...
|
by: |
last post by:
I have what's probably a simple page lifecycle question related to
dynamically evaluating values that are placed by a repeater and dynmically
placing user controls that use those values.
I'm attempting to bind a user control I've written, "ImageBox", to a
repeater.
The user control takes a custom property, "ContentID", that will execute a
database lookup and load an image.
|
by: Brad Baker |
last post by:
I am trying to make a "tabbed" interface by iterating through a dataset with
a conditional statement. For example:
----------------------------------------------------------------------------------------------------------------------
| <a href="config.aspx?siteid=FIEJGIE">Site 1</a| Site 2 | <a
href="config.aspx?siteid=DFOWEMF">Site 3</a>|
In the example above site 2 is the "current" tab.
I have the following code at the top of my...
|
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...
|
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,...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |