Gautam Buddha Temple Varanasi,Varanasi - Buddhist Pilgrimage

Monday, August 23, 2010

GridView find control

protected void ddlQty_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow gr = (GridViewRow)((DataControlFieldCell)((DropDownList)sender).Parent).Parent;
DropDownList ddlQty = (DropDownList)gr.FindControl("ddlQty");
if (ddlQty != null)
{

Label lblPrice = (Label)gr.FindControl("lblPrice");
Label lblOriginalPrice = (Label)gr.FindControl("lblOriginalPrice");
int price = Convert.ToInt32(lblOriginalPrice.Text);
int NewPrice = price * Convert.ToInt16(ddlQty.SelectedValue);
lblPrice.Text = Convert.ToString(NewPrice);

}
GridViewRow gr = (GridViewRow)((DataControlFieldCell)((DropDownList)sender).Parent).Parent;
DropDownList ddlQty = (DropDownList)gr.FindControl("ddlQty");
if (ddlQty != null)
{

Label lblPrice = (Label)gr.FindControl("lblPrice");
Label lblOriginalPrice = (Label)gr.FindControl("lblOriginalPrice");
int price = Convert.ToInt32(lblOriginalPrice.Text);
int NewPrice = price * Convert.ToInt16(ddlQty.SelectedValue);
lblPrice.Text = Convert.ToString(NewPrice);
}
}
Thanks & Regards
Santosh Singh

No comments:

Post a Comment