Click here to Skip to main content
15,909,437 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: dynamically adding columns to datagrid from sql statement Pin
gbabu1714-Aug-06 5:18
gbabu1714-Aug-06 5:18 
GeneralRe: dynamically adding columns to datagrid from sql statement Pin
Ramasubramaniam15-Aug-06 3:22
Ramasubramaniam15-Aug-06 3:22 
Questionhow to convert barcode number to pic Pin
mahmoud mohammed14-Aug-06 4:00
mahmoud mohammed14-Aug-06 4:00 
Questionhow to set HTTP Headers property 'Enable content expiration through programaticaly? Pin
subburaj.sabapathy14-Aug-06 3:30
subburaj.sabapathy14-Aug-06 3:30 
QuestionSessions in ASP.NET using C# Pin
sudheerkonda14-Aug-06 3:09
sudheerkonda14-Aug-06 3:09 
AnswerRe: Sessions in ASP.NET using C# Pin
Mike Ellison14-Aug-06 3:15
Mike Ellison14-Aug-06 3:15 
AnswerRe: Sessions in ASP.NET using C# Pin
simple one14-Aug-06 19:02
simple one14-Aug-06 19:02 
Question- ASP.net GridView - OnCommand not fired! Pin
Martines00714-Aug-06 2:58
Martines00714-Aug-06 2:58 
Hi,

I have a problem with event on LinkButton inside my TemplateField of GridView which is programmatically created.
When I create GridView's TemplateField, I use special class that inherits from ITemplate.
In this class I try to create LinkButton for every row of GridView.

This is my code:

class GridViewTemplate : System.Web.UI.Page, ITemplate<br />
    {<br />
        ListItemType templateType;<br />
        string columnName;<br />
<br />
        void ITemplate.InstantiateIn(System.Web.UI.Control container)<br />
        {<br />
            switch (templateType)<br />
            {<br />
                case ListItemType.Item:<br />
                    LinkButton lbtn = new LinkButton();<br />
                    lbtn.DataBinding += new EventHandler(Object_DataBinding);<br />
                    lbtn.CssClass = "TextBlackBold";<br />
                    lbtn.Command += new CommandEventHandler(this.TakeTaskLinkButton_OnCommand);<br />
                    lbtn.CommandName = "SubmitTakeTaskLinkButtonCommandName";<br />
                    container.Controls.Add(lbtn);<br />
                    break;<br />
            }<br />
        }<br />
<br />
        void Object_DataBinding(object sender, EventArgs e)<br />
        {<br />
            LinkButton lbtn = (LinkButton)sender;<br />
            GridViewRow container = (GridViewRow)lbtn.NamingContainer;<br />
            lbtn.ID = "TakeTaskLinkButton" + DataBinder.Eval(container.DataItem, "taskid").ToString();<br />
            lbtn.Text = DataBinder.Eval(container.DataItem, "tasktitle").ToString();<br />
            lbtn.CommandArgument = DataBinder.Eval(container.DataItem, "taskid").ToString();<br />
        }<br />
<br />
        void TakeTaskLinkButton_OnCommand(object sender, CommandEventArgs e)<br />
        {<br />
            switch (e.CommandName)<br />
            {<br />
                case "SubmitTakeTaskLinkButtonCommandName":<br />
                    Response.Redirect("Default.aspx");<br />
                    break;<br />
            }<br />
        }<br />
<br />
        public GridViewTemplate(ListItemType type, string colName)<br />
        {<br />
            templateType = type;<br />
            columnName = colName;<br />
        }<br />
    }


and the TakeTaskLinkButton_OnCommand method is not fired when I click on the LinkButton.
I don't know why!? Any suggestions? How can I solve this problem?

Regards,

(Sorry for any mistakes)

MarcinG

Question(Query)Reg : Databinding in GridView asp.net 2.0 Pin
Jay_se14-Aug-06 2:19
Jay_se14-Aug-06 2:19 
AnswerRe: (Query)Reg : Databinding in GridView asp.net 2.0 Pin
Mike Ellison14-Aug-06 3:20
Mike Ellison14-Aug-06 3:20 
GeneralThanx Pin
Jay_se14-Aug-06 3:48
Jay_se14-Aug-06 3:48 
QuestionHow to Use Paypal and 2checkout .com for Payment Pin
Amit Agarrwal14-Aug-06 0:25
Amit Agarrwal14-Aug-06 0:25 
AnswerRe: How to Use Paypal and 2checkout .com for Payment Pin
Paddy Boyd14-Aug-06 2:24
Paddy Boyd14-Aug-06 2:24 
GeneralRe: How to Use Paypal and 2checkout .com for Payment Pin
Anil Ch15-Aug-06 3:37
Anil Ch15-Aug-06 3:37 
GeneralRe: How to Use Paypal and 2checkout .com for Payment Pin
Amit Agarrwal17-Aug-06 3:13
Amit Agarrwal17-Aug-06 3:13 
GeneralRe: How to Use Paypal and 2checkout .com for Payment Pin
AnilChDotNet18-Aug-06 12:08
AnilChDotNet18-Aug-06 12:08 
GeneralRe: How to Use Paypal and 2checkout .com for Payment Pin
Amit Agarrwal18-Aug-06 18:31
Amit Agarrwal18-Aug-06 18:31 
Questionneed help with pageload Pin
neodeaths14-Aug-06 0:11
neodeaths14-Aug-06 0:11 
AnswerRe: need help with pageload Pin
seee sharp14-Aug-06 0:23
seee sharp14-Aug-06 0:23 
AnswerRe: need help with pageload Pin
Jay_se14-Aug-06 0:30
Jay_se14-Aug-06 0:30 
GeneralRe: need help with pageload Pin
neodeaths14-Aug-06 2:16
neodeaths14-Aug-06 2:16 
QuestionTree View Pin
kuwl_mark13-Aug-06 23:59
kuwl_mark13-Aug-06 23:59 
AnswerRe: Tree View Pin
Sathesh Sakthivel14-Aug-06 0:28
Sathesh Sakthivel14-Aug-06 0:28 
AnswerRe: Tree View Pin
Sathesh Sakthivel14-Aug-06 0:44
Sathesh Sakthivel14-Aug-06 0:44 
QuestionListing File and Folder Pin
Socheat.Net13-Aug-06 23:49
Socheat.Net13-Aug-06 23:49 

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.