Re: Dynamically add link button

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Martin Dechev (detcheff__at_hotmail.com)
Date: 04/20/04


Date: Tue, 20 Apr 2004 16:37:19 +0200

Hi, Simon,

See inline

"simon" <simon.zupan@stud-moderna.si> wrote in message
news:#vlUlJuJEHA.892@TK2MSFTNGP09.phx.gbl...
> I have dataRepeater and ItemTemplate:
>
> <itemTemplate>
> <%# writeLine(0,DataBinder.Eval(Container.DataItem,
> "ts_id"),DataBinder.Eval(Container.DataItem, "timeStart"))%>
> </itemTemplate>
>
> In write line function I check if there exsists something and if it does,
I
> would like to add linkButton else something else.
> When user clicks this button some pannel will show and so on.
>
> Is there some other way?
>

For me it is easier to have the linkbutton and "the other thing" ready. Just
set their visibilities and properties. But maybe in your case it is
something more complex, so if it works this way - fine.

> Second question.
>
> I have couple lists of codes. When user clicks the button, Iwould like to
> show this codes to him in some combo box.
> Then he choose one and codes dissapear.
>
> I can do that like combo box on panel and set panel's visibility to
> false.When user click the button set visibility to true and when choose
the
> code set visibility again to false.But that means that every time user
want
> this page all my lists must be loaded to him.

If the panel is Visible = false, it and all its child controls are not
rendered to the client, so there will be no load.

On the button click load the DropDownList with the values and set the panel
Visible=true. Then on the DropDownList SelectedIndexChanged event set it
Visible = false again.

Hope this helps
Martin

> That means slow page. I can do
> that dynamically and load this scripts to him only when user click buton
or
> with javaScript and window.open method.
>
> Is there some other method?
>
> Thank you,
> Simon
>
> But dynamically, this won't work
>
> "Martin Dechev" <detcheff_@hotmail.com> wrote in message
> news:%23GodB5tJEHA.892@TK2MSFTNGP09.phx.gbl...
> > Hi, Simon,
> >
> > You should add the control independant on IsPostBack. i.e.:
> >
> > "simon" <simon.zupan@stud-moderna.si> wrote in message
> > news:uwqHAltJEHA.620@tk2msftngp13.phx.gbl...
> > > On code behind file:
> > >
> > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > System.EventArgs) Handles MyBase.Load
> >
> > ' If Not Page.IsPostBack Then
> >
> > > Dim ctrl As New LinkButton
> > > ctrl.ID = "link1"
> > > ctrl.Text = "link create"
> > > ctrl.CommandArgument = "myargument"
> > > ctrl.CommandName = "mycommandname"
> > > AddHandler ctrl.Click, AddressOf link_button_click
> > > plcCategory.Controls.Add(ctrl)
> >
> > ' End If
> >
> > > End Sub
> >
> > IMO a more appropriate place to dynamically add controls is the
Page_Init
> > automatic handler or overriding the protected Contsruct method.
> >
> > Hope this helps
> > Martin
> >
> > >
> > > Sub link_button_click(ByVal sender As Object, ByVal e As
> System.EventArgs)
> > > Response.Write("test")
> > > End Sub
> > >
> > > AND page:
> > >
> > > <form id="Form1" method="post" runat="server">
> > > <asp:PlaceHolder ID="plcCategory"
Runat="server"></asp:PlaceHolder>
> > > </form>
> > >
> > > What is wrong here?
> > > I would like to dynamically add more link buttons. Here is example for
> one
> > > and click event doesn't work.
> > > All link buttons should use link_button_click event.
> > >
> > > Thank you,
> > > Simon
> > >
> > >
> >
>
>



Relevant Pages

  • Re: electricians
    ... >> I have an old rewirable fuse type comsumer unit that i would like to ... > panel up to current electrical codes. ... > starting any work check with your local codes enforcement office. ... When the inspector approves the job, ...
    (alt.home.repair)
  • Re: P0171/P0174 Help! *update*
    ... Been chasing after the source of intermittent P0171/P0174 (always both ... I do have freeze frame data from the trouble codes as noted below: ... Closed loop / closed loop ... load 19.2% ...
    (rec.autos.tech)
  • Re: Japanese date codes
    ... The best is date codes on ICs. ... PCB traces from 60s onwards tend to get less angular and more curved by the ... panel on the overlay of a PCB, ...
    (sci.electronics.repair)
  • Re: 60-806 help
    ... alarm system, and previous owners claim to have no idea what the codes ... programmer keypad for the panel itself, ... I would look at replacing the main panel control. ... That way you are starting with a fresh panel and can ensure that there aren't some other codes laying about in programming that a previous resident could use to get into your home. ...
    (alt.security.alarms)
  • Re: electricians
    ... > I have an old rewirable fuse type comsumer unit that i would like to ... panel up to current electrical codes. ... cold water pipe for a ground and didn't jumper across the meter. ... starting any work check with your local codes enforcement office. ...
    (alt.home.repair)