I need to add a button to a datagrid. I have tried using the
ButtonColumn and have also tried adding a button to a templatecolumn >
itemtemplate. Whatever I have tried doesn't work, nor does it produce
errors. The method i have specified to execute is never reached. Can
anybody tell what I am doing wrong? Thanks...
webform code:
<form id="Form1" method="post" runat="server">
<asp:datagrid id="dgconcept" runat="server"
AlternatingItemStyle-BackColor="#99ffcc" AutoGenerateColumns="False"
CellPadding="4">
<Columns>
<asp:TemplateColumn HeaderText="">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem,"conceptid") %>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Concept">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem,"concept") %>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button ID="btnQuestionList"
CommandName="showQuestions"
Text=" ? " Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
<asp:datagrid id="dgquestions"
runat="server"></asp:datagrid>
<asp:datagrid id="dganswers" runat="server"></asp:datagrid>
</form>
Codebehind:
protected void showQuestions(object source,
DataGridCommandEventArgs
e)
{
dgquestions.DataSource=dsfulltest().Tables[1];
dgquestions.Visible=true;
dgquestions.DataBind();
}
As mentioned before, when running this through a VS.NET debugger, the
code in showQuestions method is never reached. I have tried this using
the buttoncolumn instead, but with the same results--the code cannot be
reached.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!