>>>>>>Hi,
>>>>>>
>>>>>>I have ASP.NET Grid View on ASPX page bound to a dataset/table. I need to find a value of one column by the value of another column. For example, say Grid View has columns Order_no and Customer_Name. I have the customer name "ABC" and need to find the Order_no corresponding to this Customer; basically find this row. I found examples online of scanning through the Grid View. Is this the only approach? Or you can actually Search for the desired row?
>>>>>>
>>>>>>TIA
>>>>>
>>>>>You can SELECT :-)
>>>>
>>>>You mean from the DB? Or how to use SELECT in the ASP.NET Grid View?
>>>
>>>No, from DataTable :-)
>>>Something like:
>>>
>>>DataRow[] drws = DataTable.Select(...);
>>>if(drws.Length==0)
>>>{
>>>// Found some rows
>>>}
>>>
>>>
>>>I'm sure that there is LINQ way to do this.
>>
>>You see, the DataTable is not in the scope in the method where I need to find the value. The Grid View is build dynamically from a dataset.datatable. But later, when user clicks on a button of a form, the Submit click only has the reference to the Grid View itself. So I need to get the value from the Grid View ID.
>
>GridView.DataSource?
If I do the following
DataTable myTable = (DataTable)Gridview1.DataSource;
the value of myTable is NULL.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham