Click here to Skip to main content
15,900,816 members
Home / Discussions / C#
   

C#

 
QuestionRunning SQL Files Pin
N a v a n e e t h27-Feb-07 0:58
N a v a n e e t h27-Feb-07 0:58 
AnswerRe: Running SQL Files Pin
andre_swnpl27-Feb-07 1:30
andre_swnpl27-Feb-07 1:30 
GeneralRe: Running SQL Files Pin
N a v a n e e t h27-Feb-07 2:15
N a v a n e e t h27-Feb-07 2:15 
GeneralRe: Running SQL Files Pin
sam#27-Feb-07 2:55
sam#27-Feb-07 2:55 
GeneralRe: Running SQL Files Pin
N a v a n e e t h27-Feb-07 2:58
N a v a n e e t h27-Feb-07 2:58 
QuestionLinkButton click event in custom web control Pin
Matglas27-Feb-07 0:29
Matglas27-Feb-07 0:29 
AnswerRe: LinkButton click event in custom web control Pin
Stefan Troschuetz27-Feb-07 0:33
Stefan Troschuetz27-Feb-07 0:33 
GeneralRe: LinkButton click event in custom web control Pin
Matglas27-Feb-07 1:34
Matglas27-Feb-07 1:34 
This is my code. When creating the child controls I add a linkbutton that has is linked to method viewLogLButton_Click(). But this method does not not execute. I deleted some original code because it was a lot longer.

[ToolboxData("<{0}:ExceptionViewer runat=server />")]
[DesignTimeVisible(true)]
public class ExceptionViewerControl : WebControl
{
    protected override void RenderContents(HtmlTextWriter output)
    {
        this.EnsureChildControls();
        this.RenderChildren(output);
    }
    protected override void OnInit(EventArgs e)
    {
    }
    protected override void CreateChildControls()
    {
        this.Controls.Clear();
        HtmlTable RenderTbl = LoadLogDirectory();

        this.Controls.Add(RenderTbl);
    }

    private const string mainTblId = "exViewerTbl";
    private String fileLoad = null;

    private HtmlTable _mainFileTable = new HtmlTable();
    private HtmlTable MainFileTable
    {
        get { return _mainFileTable; }
        set { _mainFileTable = value; }
    }

    private HtmlTable LoadLogDirectory(FileInfo file)
    {
        this.MainFileTable = new HtmlTable();

        LinkButton viewLogLButton = new LinkButton();
        viewLogLButton.CommandName = "ViewLogFile";
        viewLogLButton.CommandArgument = file.Name;
        viewLogLButton.Text = file.Name;
        viewLogLButton.Click += new EventHandler(viewLogLButton_Click);

        ControlCollection controls = new ControlCollection(this);
        controls.Add(viewLogLButton);

        if (fileLoad == file.Name) {
           //action
        }

        this.MainFileTable.Rows.Add(GetHeaderRow(controls));
        return MainFileTable;
    }

    void viewLogLButton_Click(object sender, EventArgs e)
    {
        fileLoad = ((LinkButton)sender).CommandArgument;
    }

    private HtmlTableRow GetHeaderRow(ControlCollection controls)
    {
        //header cell
        HtmlTableCell headerCell = new HtmlTableCell();
        headerCell.Attributes["class"] = styleClass;
        headerCell.Attributes["colspan"] = span.ToString();
        foreach (Control ctrl in controls)
        {
            headerCell.Controls.Add(ctrl);
        }
        headerRow.Cells.Add(headerCell);

        return headerRow;
    }
}


Matglas
GeneralRe: LinkButton click event in custom web control Pin
Stefan Troschuetz27-Feb-07 3:01
Stefan Troschuetz27-Feb-07 3:01 
GeneralRe: LinkButton click event in custom web control Pin
Tuwing.Sabado27-Feb-07 15:26
Tuwing.Sabado27-Feb-07 15:26 
GeneralRe: LinkButton click event in custom web control Pin
Matglas27-Feb-07 21:25
Matglas27-Feb-07 21:25 
Questiontreeview Pin
dtarunnayudu27-Feb-07 0:26
dtarunnayudu27-Feb-07 0:26 
AnswerRe: treeview Pin
alex.almeida27-Feb-07 2:16
alex.almeida27-Feb-07 2:16 
GeneralRe: treeview Pin
vasava18-Jan-09 23:08
vasava18-Jan-09 23:08 
Questioncapture a sound from my sound card and save it as Byte[] Pin
marwan_siala26-Feb-07 23:52
marwan_siala26-Feb-07 23:52 
QuestionFind Form, Find Button, And press It Pin
Jefis26-Feb-07 23:47
Jefis26-Feb-07 23:47 
AnswerRe: Find Form, Find Button, And press It Pin
Martin#26-Feb-07 23:56
Martin#26-Feb-07 23:56 
GeneralRe: Find Form, Find Button, And press It Pin
Jefis26-Feb-07 23:58
Jefis26-Feb-07 23:58 
GeneralRe: Find Form, Find Button, And press It Pin
Martin#27-Feb-07 0:08
Martin#27-Feb-07 0:08 
GeneralRe: Find Form, Find Button, And press It Pin
Jefis27-Feb-07 0:23
Jefis27-Feb-07 0:23 
AnswerRe: Find Form, Find Button, And press It Pin
Martin#27-Feb-07 0:26
Martin#27-Feb-07 0:26 
GeneralAnswer To Mark T. Pin
Martin#27-Feb-07 20:37
Martin#27-Feb-07 20:37 
QuestionSmart Devices and databases Pin
BOND_JAMES26-Feb-07 23:35
BOND_JAMES26-Feb-07 23:35 
QuestionForm does not show Pin
wasife26-Feb-07 23:23
wasife26-Feb-07 23:23 
AnswerRe: Form does not show Pin
Seishin#27-Feb-07 2:04
Seishin#27-Feb-07 2:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.