I'm still not entirely sure what you want to do. I take it english is not your first language?
Are india tour and world tour catagories ?
So I choose a category, then I see a datagrid of tour products, one of which is a hotel booking ? So hotel booking is in the datagrid?
A textbox and button should appear in a datagrid column oposite only the hotel booking product, to the right hand side?
Use the OnItemDataBound event of the datagrid, use the event args to determine if the row is a hotel booking, make the textbox and button visible
<asp:DataGrid ID="dgprodlist" Runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn HeaderText="Product" DataField="Product"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:TextBox ID="txtText" Runat="server"></asp:TextBox>
<asp:Button ID="btnButton" Runat="server" Text="Button"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
public class itinerary : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid dgprodlist;
//set up some data
private string[] products = {"Product 1","Product 2","Hotel Booking"};
private DataTable prodList = new DataTable();
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(!IsPostBack)
{
//Add a column (I don't have your database so I have to mock it up)
prodList.Columns.Add("Product");
//add some rows
for(int i = 0; i < 3; ++i)
{
DataRow row = prodList.NewRow();
row[0] = products[i];
prodList.Rows.Add(row);
}
//Bind the data
dgprodlist.DataSource = prodList;
dgprodlist.DataBind();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.dgprodlist.ItemDataBound += new DataGridItemEventHandler(dgprodlist_ItemDataBound); //Wire up the event. Fires on row creation during DataBind()
}
#endregion
private void dgprodlist_ItemDataBound(object sender, DataGridItemEventArgs e)
{
//Test for rows, don't want to execute code on header item that will cause an exception.
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
//Get a reference to the textbox and button control
TextBox tb = (TextBox)e.Item.Cells[1].FindControl("txtText");
Button b = (Button)e.Item.Cells[1].FindControl("btnButton");
//If it's the hotel booing product show the controls, else hide them
if(e.Item.Cells[0].Text == "Hotel Booking")
{
tb.Visible = true;
b.Visible = true;
}
else
{
tb.Visible = false;
b.Visible = false;
}
}
}
}