i have exception Conversion from string "System.Web.UI.WebControls.TextBo" to type 'Integer' is not valid.

on these line

Dim no_single_room As Int32 = CType(DirectCast(dataItem.FindControl("txt_single"), TextBox).ToString(), Int32)
                        Dim no_double_room As Int32 = CType(DirectCast(dataItem.FindControl("txt_double"), TextBox).ToString(), Int32)

Hi,

When you are trying to cast textbox control instead of its value, the specified error will occur.

So change the code as needed.

good luck.

Dim no_single_room As Int32 = CType(DirectCast(dataItem.FindControl("txt_single"), TextBox).text , Int32)                       no_double_room As Int32 = CType(DirectCast(dataItem.FindControl("txt_double"), TextBox).text, Int32)

Try this code....this should work

Be a part of the DaniWeb community

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