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

Top 5 Contributors of the Month
Post New Web Links

Having trouble creating RegEx to extract value from GridView row

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :.NET Framework
Hey Everyone,
Since I had such great help with my first RegEx problem I thought I'd give it a second try. This one is a fair bit more complicated. I need to extract a value from within an onclick attribute of an input (button) in a the row of a grid that contains a column that contains certain text. Here is the html: 

<tr class="rgRow" id="ctl00_ContentPlaceHolder1_OrganizationsRadGrid_ctl00__24">

View Complete Post

More Related Resource Links

Dynamically creating Gridview Template - Linkbutton Click not working



I have written some code to dynamically generate template columns for gridview which works well. However, each cell in the gridview has to be a linkbutton, which when clicked does a db update and redirects to a specific url with some parameters in it.

I have attached a click event handler to the linkbutton in the InstantiateIn method but the event does not seem to fire.

Could someone please help? the code is below -

//Dynamically creating the Grid

protected void btnAnalyze_Click(object sender, EventArgs e)

Creating a gridview to allow editing of current users


I finally got membership and roles setup and seems to be working.

I have setup a page to allow the creation of a user and editing of roles for a user.

I would like to setup a page with a gridview that displays all users and what roles they are assigned. I remember running across someone else that was looking to do the same thing, but cant find it. Not sure if it was in this forum or online somewhere else.

But i found that i can use the  aspnet_Membership_GetAllUsers procedure in my db to get all the users, but how can i add the roles to each person and possibly setup the gridview so that each role they have, is displayed on their row in the gridview

So i would like to see something like this maybe more data displayed depending on the client request.

Username                 Email                 Last Login                          Roles

meofcourse               m

RegEx Request - Extract an tag from string...

Hello, Can anyone give me a regular expression that will extract the <img> tag from a string.  I am receiving descriptions from an rss feed and the description contains an <img> tag in the text.  I want to extract the <img> so that I can display it in a different location on my page. I have fooled with some regular expressions, but my knowledge of them is not very good. Thanks in advance for any help!!

How to extract City State Zip using Regex match

Hi there - I am parsing a file which contains customer address in the following 2 formats:   Format #1 12345 Melrose Place New York NY USA 12987     Format # 2: 12345 Melrose Place New York NY 12987   I need to put the data into Address, City, State and Zip fields. I am able to parse and put the data (specifically line 2) in the fields for format #1 but am having issues doing the same for format # 2 because format # 2 doesn't have USA as a reference point. Below is my code if any expert can help that will be appreciated Dim AddressChunk As String = tokenizer.NextToken() If AddressChunk.Contains("USA") Then _State = AddressChunk.Substring(AddressChunk.IndexOf("USA") - 4, 2).Trim _City = AddressChunk.Substring(0, AddressChunk.IndexOf("USA") - 4).Trim _Zip = Regex.Match(AddressChunk, "\d{5}").Value Else _Zip = Regex.Match(AddressChunk, "\d{5}").Value _State = AddressChunk.Substring(Regex.Match(AddressChunk, "\s[a-zA-Z]{2}\s\d{5}").Value - 5).Trim _City = End If

Creating dynamic template columns in gridview

how to create dynamic template columns in gridview  . I have writing some of the code but it gives me error The type or namespace name 'GridViewLabelTemplatecould' not be found (are you missing a using directive or an assembly reference?)    I have paste some my code /con.Open();        string strsql = "select ID,CompanyName from tblcompany";               SqlCommand cmd = new SqlCommand();        cmd.CommandType = CommandType.Text;        cmd.CommandText = strsql;        cmd.Connection = con;        SqlDataAdapter adpt = new SqlDataAdapter();        adpt.SelectCommand = cmd;        adpt.Fill(dt);        GridView1.Columns.Clear();        for (int i = 0; i < dt.Columns.Count; i++)        {            TemplateField tf = new TemplateField();            // create the data rows       

Retrieve data from select columns without creating Gridview etc??

I have an accessdatasource with multiple columns, one column I use it to populate a dropdownlist. Can I use the data from other columns to insert into a table,  insert being done in the aspx.vb page, without creating gridview etc.   Is it possible to make a detailsview one column visible= false and still be able to evaluate its contents? Thanks,

Extract String using RegEx

HelloI have below data in string format in a field in table and would like to parse the name from the quantity. The name should be anything before it hits a numeric numberin below example CHLORPHENIRAMINE is the name. i really appreciate if i can get a regex to extract the name from below string                                    "CHLORPHENIRAMINE 8MG CAP SA",                                    "CHLORPHENIRAMINE 12MG CP SA",                                     "CHLORPHENIRAMINE 4MG TABLET",                                     "CLEMASTINE FUM 2.68MG TAB",             &n

Trouble with URL when creating new site from template


Last year created I a site that I saved as a template so that I could create a new site for 2011 using the same site structure.  Now I've created the new site for 2011 but I can see I made a naming error in my old site, in that I put the year on a list name and this has now transferred to the new site.

Here is the URL from last year:  /LegWeb/2010/Lists/2010Bills/AllItems.aspx.  I should have named the list  "Bills"  instead of "2010Bills"  because now in my new site the URL looks like a mistake:  /LegWeb/2011/Lists/2010Bills/AllItems.aspx.


What can I do to change that URL now?

Reg: Creating custom gridview....


Can anyone give some sample code for the following ?

I want to create the custom gridview control to load page quickly. For example if I have 1,00,000 records , but i want to show only 20 records in a gridview control. If I use asp.net gridview then we need to load all 1,00,000 records and give the page size as 20.But it will take long time to load. Instead want to make gridview control of 20 records per page with 1,00,000 records paging logic without loading all the records.

Please let me know if any one have idea about this.


Does Regular Expression (RegEx) able to extract Sentence from paragraphs



I am new to Regular languages; I have been trying to find out whether Regex is able to extract sentences from any paragraph (text) on PDF format based on particular words (pattern).



Can you please outlines this with example in C#


Thank you in advance  

please help me in creating gridview using three tier archi - i have done the coding but need more im


i am a fresher, and i am laering asp.net by myself using internet tutorials,

i am creating a website using three tier logic, i have created the sign in page with 5 controls, firstname, lastname,userid,pasword,con password.

and its working nicely using the three tier,

the same i need to perform the edit and delete section in grid view, i have tried so many times but its creating me some error, i am here posting the codel please help me to recover it

data access layer code for delete oepration

public int delete( int Userid)

        SqlConnection con = new SqlConnection("Constr");


        SqlCommand cmd = new SqlCommand("three_delete",con);

        cmd.CommandType = CommandType.StoredProcedure;




Having trouble using .css page to style GridView, pagerstyle

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" emptydatatext="No data available." 
        AutoGenerateColumns="False" DataSourceID="SqlDataSource1" CssClass="table" >

    <PagerSettings mode="Numeric" position="Bottom" pagebuttoncount="5"/>

    <PagerStyle CssClass="pager"/>

.pager, .pager a {


Hi, I'm having multiple problems here:  1) css styling changes never show up right away--even when I press Control F5 (takes effect at "some point"--in IE8---when I least expect it)    2) I can't get the current pag

Trouble creating page layout for sub sites


I have a sub sie called 'subsite1' and it's parent site is 'site'

I have created a custom content type called 'contentType1' in custom group called 'Group1'.

I then tried to created a page layout vai sharepint designer, called 'pagelayout1.aspx' by selecting the cotent type group 'Group1', its content type 'contentType1', URL 'pagelayouttest' and its title but I ran into an issue.

I got an error message says

Content type '0x010.........4FADEG26.....' not found in web 'http://sampledomain'

once I ok the error message, the 'pagelayouttest.aspx' was created in the parent 'site' _catalogs/masterpage/ location

Because of this I cannot create any page in subsites using it's new page layout.

Any ideas?

REGEX to extract fourth and fifth position in a word



Was looking for regex to extract letters from fourth and fifth position in a word. (Word can have numbers followed by words)

ABCDEFGH111XYZ should return DE

COLDCOLD81928TEST should return DC

ANILANILTEST128ANIL should return LA

Appreciate all your help/support in advance.





Trouble Creating SQL Server Peformance Condition Alert


I was attempting to create a SQL Server alert that checked for the log file size of a database.  The issue is that my database is not listed under "instance".  Other databases are missing as well but I do not know how or why a database shows up under instance name.  Does anyone know how I can get my database to show up in the instance dropdown list?

Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.
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