473,387 Members | 1,497 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,387 software developers and data experts.

set visibility of label in datagrid IF text string present

Hello-

I have page on my site that displays the results of a product search in
a datagrid.

There is a text field that has a full description of the product named
FullInfo. I have placed some keywords in this description that denote
certain things about the product such as SALE, CLOSEOUT, FREE_SHIPPING,
etc.

I have labels in the datagrid template for each condition above (SALE,
CLOSEOUT, etc). These lables are all set to Visible="False". I'd like
to make these visible IF the keyword appears in the FullInfo text
field.

I am stuck on figuring out how to read through the text in the FullInfo
field for the keywords. I have tried using a sub-routine with an IF
statement and IndexOf to determine if the keyword is present but that
did not work.

Any help is appreciated, thanks!

Rick D.

Apr 10 '06 #1
3 1123
Are you able to extract the string from the cell?
Look into Regular Expressions (Regex)

Apr 10 '06 #2
IndexOf would certainly work.

dim i as integer

Dim strTest As String = "we have a SALE on foxes"

i = strTest.IndexOf("SALE")

if i > 0 then....
<fo**********@gmail.com> wrote in message
news:11**********************@z34g2000cwc.googlegr oups.com...
Hello-

I have page on my site that displays the results of a product search in
a datagrid.

There is a text field that has a full description of the product named
FullInfo. I have placed some keywords in this description that denote
certain things about the product such as SALE, CLOSEOUT, FREE_SHIPPING,
etc.

I have labels in the datagrid template for each condition above (SALE,
CLOSEOUT, etc). These lables are all set to Visible="False". I'd like
to make these visible IF the keyword appears in the FullInfo text
field.

I am stuck on figuring out how to read through the text in the FullInfo
field for the keywords. I have tried using a sub-routine with an IF
statement and IndexOf to determine if the keyword is present but that
did not work.

Any help is appreciated, thanks!

Rick D.

Apr 10 '06 #3
Jeff-

I've got that exact code working on other pages where the field in
question has been placed into a Label.

On this page that I am working on, the text that I need to search
through is in the datagrid. It's being called like this:
<%# DataBinder.Eval(Container.DataItem, "FullInfo") %>

I succesfully added a new Label named lblFullInfo INSIDE that datagrid
template and set the Text property to = <%#
DataBinder.Eval(Container.DataItem, "FullInfo") %>. This works and
shows up when I test the page.

However, when I add my script, I get the error:
Name 'lblFullInfo' is not declared.

Here is my script:

<script runat="server">
dim isFreebie as String = lblFullInfo.text
if isFreebie.IndexOf( "freebie" ) > 0 Then
lblFullInfo.visible = True
End if
</script>

NOTE: I only have access to the aspx page, I cannot get to the
code-behind.

Thanks!

Rick D.

Apr 10 '06 #4

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

Similar topics

3
by: Stephen | last post by:
I've got a datagrid with a remove button and I would like to add some code in the code behind page so as whenthe button is clicked the corresponding row in the datagrid is removed. The Datagrid is...
6
by: thejackofall | last post by:
I added a label server control in my aspx file. In the code behind, the IDE does not generate the corresponding object like it does with buttons and other objects. What am I doing wrong? Is...
3
by: Dom | last post by:
Hi, I have a werid problem with a subreport. If someone can help me out I'd be very grateful! Based on results from a query, the visibility of textboxes and labels in a subreport are set to...
0
by: Mauro | last post by:
Hi, I need a big help to resolve this problem. I need to put a usercontrol in a datagrid: this control check if the code inserted is present in a archive and if not return a error message. (In...
3
by: GM | last post by:
I am building the text for a resume section label in databinding with 20 or so data columns using a series of 20 or so code snippits like the following: If e.Item.DataItem("EmployerDisplay") And...
0
by: Giovane Calabrese | last post by:
ok. im try to make a multilanguage system based on that tutorial : http://www.123aspx.com/redir.aspx?res=29112 in my aspx pages all text are in labels , and i want to take the name labels...
2
by: bredal Jensen | last post by:
Hello there, I need to show or hide a label cotrol in one of the cell of my datagrid. I tried the following: ---------- DataGridItem item = MyDataGrid.Items;
0
by: Rocky | last post by:
Dear ALL, I am facing a bit problem in DATAGRID. so may be you guys can help me out. Actually on a DataGrid I am having following controls: 1) 2 DropDown Menu 2) 1 Text Box 3) 1 ADD Button 4)...
2
by: Steve JORDI | last post by:
Hi, I have a strange problem using Internet Explorer. My page has a table included in a <DIV> I have a checkbox that shows the div when checked and hides it when unchecked. var division =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.