literal Databinding???

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()
 
T

Teemu Keiski

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.
 
T

Teemu Keiski

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???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top