CopyPastor

Detecting plagiarism made easy.

Score: 0.8186972141265869; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2012-03-06
by ankit rajput

Original Post

Original - Posted on 2010-10-13
by Delebrin



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Use following Function to get Column Index:
private int GetColumnIndexByName(GridView grid, string name) { foreach (DataControlField col in grid.Columns) { if (col.HeaderText.ToLower().Trim() == name.ToLower().Trim()) { return grid.Columns.IndexOf(col); } } return -1; }

I figured it out, I needed to be using `DataControlField` and slightly different syntax.
The working version:
private int GetColumnIndexByName(GridView grid, string name) { foreach (DataControlField col in grid.Columns) { if (col.HeaderText.ToLower().Trim() == name.ToLower().Trim()) { return grid.Columns.IndexOf(col); } } return -1; }

        
Present in both answers; Present only in the new answer; Present only in the old answer;