2 simple questions

S

simon

I have dataRepeater:

<asp:Repeater ID="repeater1" Runat="server">
<ItemTemplate>
<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"))%>
</ItemTemplate>

<FooterTemplate>
<asp:Button ID="btnDelete" Runat="server" Text="Delete"></asp:Button>
</FooterTemplate>
</asp:Repeater>

Then my function:

Protected Function writeLine(ByVal dan As String)as string

writeLine="<input onclick='" & btnDelete.ClientID & ".click()'
type='button' value='Delete'>"

....and so on

End Function

Why I can't use btnDelete.ClientID here?

I would like that when user click the button, the button btnDelete on the
client is clicked. Do you have any solution?

And second question:

If I have:

<ItemTemplate>

<asp:button runat=server id=btnTest></asp:Button>

<%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"))%>

</ItemTemplate>

And my function:

Protected Function writeLine(ByVal dan As String)as string

btntest.visible=false

.....

End Function

Why I can't reference the button in my function. I always get the error
message: Not set to the instance of the object

I set the reference on the beginning of the code behind class:

Protected WithEvents btnTest As System.Web.UI.WebControls.Button

Do you know the answer,

Thank you,

S
 
A

Ashish M Bhonkiya

Hi simon,

can u try adding the javascript part to the button in the itemdatabound
event for the repeater control ?

in the itemdatabound event
retrieve the button and call btn.attributes.add();

HTH
Regards
Ashish M Bhonkiya
 

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,780
Messages
2,569,611
Members
45,286
Latest member
ChristieSo

Latest Threads

Top