.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Post New Web Links

Most efficient way to check whether a DataGridView contains some specific text at a specific column

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :.NET Framework
Dear All,   I am looking at the most efficient way to check whether a specific column of a DataGridView contains some text. For example I have a list of firs names and I would like to check whether the text "Bob" already exists in that columns. I would like to avoid to loop through each row but what thinking of using something with "Contains".   Anybody has an idea ?   Cheers,   Kalos

View Complete Post

More Related Resource Links

Hide data for specific column from a user

Greetings, I have a problem. I would like to restrict showing specific users (or roles or schemas) data in a column. First I thought DENY option will do it but figured out that it won't. DENY denies the column being in the SELECT query. I would still like to call the column but if access to the data in that column is restricted it would show only null values and not the real ones. So... I would like call the next query from user TestUser: SELECT ID,Name,Address FROM Employee But if access to Address is restricted for TestUser I would get results like: ID Name Address 1 John Smith NULL 2 Rick Ross NULL ... Is it possible to do something like that in SQL Server 2005/2008? I was thinking of storing that kind of information in a table (for which tables, which columns for which users access is restricted) and then manipulate it on the application site but my programmers tell me that they use components which always call the full table (like SELECT *).  Thank you for your answer.

anchor text box to specific location in report?

In my report, I've got a map of the world as the background image. In it, I want some textboxes set over certain countries displaying some metrics for them. is there any way to 'anchor' the text boxes  to an exact location on the map? The issue that I'm having is that when the display size changes, then the text boxes move around. Any ideas? 

how to display a row-specific owner-drawn tooltip in a datagridview?

I have an unbound datagridview and an owner-drawn tooltip in C# 2008. I want the draw event to be called on the tooltip. it does not get called. how can i make it get called, or otherwise display an owner-drawn tooltip, row specific? the popup event does get called and resizes the tooltip, but it stops there.

Add column in a specific order


When I use the below command it would add an column at the end (i.e. the last column in the table), how can I add an column say after the 4th column?



TABLE [dbo].[Order] ADD OrderId INT NULL

Painting/Filling a specific cell using CellPainting event of datagridview



I am trying to paint a quantity column in data grid with color red, however when I do so cell alignment changes to left. 

Seems like I have to convert e.value to string in order for this to work and when I do that the cell alignment changes.

Quantity column is of type decimal.

Also I would appreciate if you can guide on how i can fill the certain columns in data grid with certain color(for ex. yellow).

 if (this.dtaGridView.Columns[7].Index ==e.ColumnIndex && e.RowIndex >= 0)




how to remove every specific text in a table


# <form id="form1" runat="server">  
#     <table id="tblFoo" border="7" cellspacing="10">  
#         <tr>  
#             <td>  
#                 This is a TD cell  
#             </td>  
#             <td>  
#                 <pre> </pre>  
#             </td>  
#             <th>  
#                 This is a TH cell  
#             </th>  
#         </tr>  
#         <tr>  
#             <th valign="TOP">  
#                 Text aligned top  
#             </th>  
#             <th>  
#             </th>  
#             <th>  
#             </th>  
#         </tr>  
#         <tr>  
#             <th valign="BOTTOM">  
#                 Text aligned bottom  
#             </th>  
#             <td>  
#             </td>  
#             <td>  
#             </td>  
#         </tr>  
#             <td>  
#                 This is a TD cell  
#             </td>  
#             <td>  
#                 <pre> </pre>  
#             </td>  
#             <th>  
#                 This is a TH cell  
#             </th>  
#         </tr>  

how to jquery remove a specific text in table


a table create

<TD>This is a TD cell</TD>
<TD><PRE> </PRE></TD>
<TH>This is a TH cell</TH>
<TH VALIGN="TOP">Text aligned top</TH>
<TH>Image in TH cell with default alignments ---></TH>
<TH><IMG SRC="blylplne.gif" ALT="airplane"></TH>
<TH VALIGN="BOTTOM">Text aligned bottom</TH>
<TD><Image in TD cell with default alignments ---></TD>
<TD><IMG SRC="blylplne.gif" ALT="airplane"></TD>

but i require ttext

This is a TH cell
is deleted and display "Rituranjan"

How to Disable Specific Column in Data Grid View and write something in Cell and load data in anothe


Hello All  ,

i have data grid view and i want to disable specific column from writing in it and in another column 

i want to write something like item code and load the item name automatically in the corresponding cell in the disabled column 

i hope that i write my problem correctly and you can understand what i want :)

thanks in advance ,

Kareem Naguib

Printing to printer. Not the page but some specific text.



I do run System.net.Mail on my web pages to send email confirmations. For those who doesn´t have an email I would like to print the letter to a printer.

Below is my code to send a body to the email. It works great. How ever. Could I somehow add a function to my page so when customer has no email the page instead prints the code to our network printer?

Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("    <center> <img src=cid:companylogo> </center><br><br> " & fornamn & " " & efternamn & " " & "<br><br> " & adressen & "<br><br> " & "" & postnummer & " " & "" & postorten & "<br><br><p><strong>Välkommen som medlem i XXXX! </strong></p><p><strong>Tack för din beställning!", System.Text.Encoding.UTF8, "text/html")

enabling the cursor in a specific cell within a datagridview


guys, i have an add record button in my datagridview application

i would like to enable the cursor on the first cell (in the last row) so the user would be able to enter some more information

i created an on click event, and can get and select the last row

but how do i set the cursor inside the specific cell ?

  Private Sub TestButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TestButton.Click
        Dim RowCount As Integer = Me.grdAccountTypes.RowCount - 1
        Me.grdAccountTypes.FirstDisplayedScrollingRowIndex = RowCount
        Me.grdAccountTypes.CurrentCell = grdAccountTypes.Rows(RowCount).Cells(0)
End SUb

Specific text issue



I have a textbox and button in my webpage. Onclient click I am calling the function. I am just displaying the entered text in alert. But when I gave this text 'Avodart® Establishing Predictors of EP-Treatment Adherence:  Linking Symptom Improvement to Adherence
(A Prospective Patient & Provider Study)'

then only this part displaying. 'Avodart® Establishing Predictors of EP-Treatment Adherence:  Linking Symptom Improvement to Adherence'

Find below code for your reference.

<script type="text/javascript" >
        function validation() {
            var a = document.getElementById('TextBox1').value;
             alert(a);    }


<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="validation();"/>
<asp:TextBox ID="TextBox1" runat="server" MaxLength="200"></asp:TextBox>


CAML query to check if user is member of a specific group


I've got a nested query caml which basically should check 3 things:

  1. Check if a task has been assigned directly to the ucrrent user
  2. Check if a task has been assigned to a group the user is in
  3. Check if the user is member of a specific

The first to bullet points work like a charm, but I can't figure out how to get the last one to work. Here is what I thought should work:

query += "<Where>";
query += "<Eq><Membership Type=\"CurrentUserGroups\">";
query += "<Value Type=\"String\">Name of my specific group</Value>";
query += "</Membership></Eq>";
query += "</Where>";

Somehow it doesn't seem to be the correct approach, is there somebody who can help me out on this? Thanks

how to create an specific column and use it in many lists like "Title" field

In my sharepoint site I have lists that some fields are repeating in two list or more,to prevent of repeating I want to define one column or field and use it in any lists that I want, so I defined a column as an empty element and add it into my project,and in schema.xml file of my list .I add the

<FieldRef ID

how to create an specific column and use it in many lists like "Title" field

In my sharepoint2010 site I have lists that some fields are repeating in two list or more,to prevent of repeating I want to define one column or field and use it in any lists that I want, so I defined a column as an empty element and add it into my project,and in schema.xml file of my list .I add the

<FieldRef ID

SQL 2008 table ORDER BY (individual specific value in column)?


Hi I have SQL 2008 table like,
AccountCode       AccountDesc       Value            Date                         ......       ....          ......
ACC1                  Receipts Total     50.88       2010-12-25
ACC1                  Delivery Total      140.12     2010-12-25
ACC1                  Post Amt            798.88      2010-12-25
ACC1                  Check Amt          31.70       2010-12-25
ACC1                  Cross Amt          90.82        2010-12-25 
ACC2                  Receipts Total     50.88       2010-12-25
ACC2                  Delivery Total      140.12     2010-12-25

Copying text from a ComboBoxItem to a specific UserControl...?



I have a system of UserControls on the screen, one of the controls they contain is a ComboBox which has around 20 items in it, each named StringName1, 2, etc. What I'd want to happen is once one of these ComboBoxItems is selected, the next UserControl I click on (i.e. the next UserControl which experiences a MouseUp event) gets the name of the string, e.g. StringName13, pasted into a dedicated TextBlock which is present in all of this type of UserControl.

A bonus would be if the pasted text, when hovered over, would display the same ToolTip as the original StringName did in the ComboBox list.

Cheers for any help :)

Calculations on specific cells of column group in tablix


i have a tablix which shows sales for current period,year-to-date,last year period, and last year year-to-date.

sales         P4   YTD  LastYearP4 LastYearYTD 

x             100   400    85               230

y             23    99     19                 82

TOTAL     123  499    104              312

i want to have an index column based on formula current period/last year period. Here periods are part of column group.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend