question about databind in user control

  • Thread starter Thread starter ¥øÃZ½Þ
  • Start date Start date
¥

¥øÃZ½Þ

Dear All

I have write a user control which is uses to popup a new browser and
inherited ImageButton

It have a user defined property named url

and in the aspx page, the code like this

<ctl:PopupImageButtonControl id="ctlButton"
runat="server"

url='page.aspx?parameter1=<%# DataBinder.Eval(Container,
"DataItem.Parameter1")%>&parameter2=<%# DataBinder.Eval(Container,
"DataItem.Parameter2")%>&'/>

In above case, if i pass <%# DataBinder.Eval(Container,
"DataItem.Parameter1")%> only, it can bind, however, if i bind the data with
some other string, it cannot bind the data to the property, is it possible
to bind the data to the property with string appended?

Thanks
 
When you're databinding a property....you can only have a databinding
expression or a string expression....not a combination of both.

so.....try this:
url='<%# "page.aspx?parameter1="+DataBinder.Eval(Container,
"DataItem.Parameter1")+"Parameter2="+DataBinder.Eval(Container,
"DataItem.Parameter2") %>'
 
oh...~ ic~~ thanks a lot~
^.^

David Jessee said:
When you're databinding a property....you can only have a databinding
expression or a string expression....not a combination of both.

so.....try this:
url='<%# "page.aspx?parameter1="+DataBinder.Eval(Container,
"DataItem.Parameter1")+"Parameter2="+DataBinder.Eval(Container,
"DataItem.Parameter2") %>'
 

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

Back
Top