wissam.ashkar 0 Newbie Poster

I have a RadGridView filled from database, when i click on a cell the whole row data is displayed in textboxes. The problem is when i click the GridView column header i get an error. What I want is when i click the column header the table is sorted (default RadGridView behavior) and when I click on data cell the data will display in textboxes like before.

example of what i want to make it more clear:

if (GoodsGrid.Columns.header.click)
do nothing
executes my code

Here's my code

private void goodsGrid_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
            gCode.Text = this.goodsGrid.Rows[e.RowIndex].Cells[0].Value.ToString();
            gName.Text = this.goodsGrid.Rows[e.RowIndex].Cells[1].Value.ToString();
            gType.Text = this.goodsGrid.Rows[e.RowIndex].Cells[2].Value.ToString();
            gUnit.Text = this.goodsGrid.Rows[e.RowIndex].Cells[3].Value.ToString();
            gCostPrice.Value = Convert.ToDecimal(this.goodsGrid.Rows[e.RowIndex].Cells[4].Value);
            gNetProfit.Value = Convert.ToDecimal(this.goodsGrid.Rows[e.RowIndex].Cells[5].Value);
            gSalePrice.Value = Convert.ToDecimal(this.goodsGrid.Rows[e.RowIndex].Cells[6].Value);
            gCurrentQuantity.Value = Convert.ToDecimal(this.goodsGrid.Rows[e.RowIndex].Cells[7].Value);
            gTotalQuantity.Text = Convert.ToString(gCurrentQuantity.Value);        
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.