literal Databinding???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone explain how I create a databinding to a Literal control! I tried doing it as shown below but the reader won't read into the control.

Thanks


...::CODE::..
Dim Myconn As New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("PageDetails", Myconn)
cmd.CommandType = CommandType.StoredProcedure

Myconn.Open()

Dim objOfficeName, objID As SqlParameter
objOfficeName = cmd.Parameters.Add("@OfficeName", SqlDbType.Char)


objOfficeName.Direction = ParameterDirection.Input


objOfficeName.Value = "ISC"


Dim myReader As SqlDataReader = cmd.ExecuteReader()
importTxt = myReader
importTxt.DataBind()

myReader.Close()

Myconn.Close()
 
Hi,

it's not databindable that way straight. Instead, you'd set its Text
property to the text you wish Literal to display.


--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke




Tim::.. said:
Can someone explain how I create a databinding to a Literal control! I
tried doing it as shown below but the reader won't read into the control.
 
What are you trying to do with this line?

If objImpCnt Is "" Then


--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke



Tim::.. said:
OK! I tried to do what you suggested Teemu but it just doesn't return
anything! I don't even get an error! Any ideas???
 
Back
Top