Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

lnkButton is not enabled

Status
Not open for further replies.

crxcte1

Programmer
May 22, 2003
74
US
I start my page displaying a datagrid and click a lnkButton to go to a form. Now a different lnkButton is enabled to go back to the datagrid, the link is active but I go no where.
The form is enbedded in a table. Some code listed below. I've been on this too long and need some help. Thanks.

void Page_Load(Object sender, EventArgs e)
{
if (! IsPostBack) {bindDataGrid();}
InsertForm.Visible=false;
...
}
//datagrid
void doMembers(Object s,EventArgs e)
{
bindDataGrid();
Response.Write("Over Here");
lnkInsert.Enabled=true;
lnkMembers.Enabled=false;
datagrid1.Visible=true;
InsertForm.Visible=false;
}
//form
void doInsert(Object s,EventArgs e)
{
bindDataGrid();
Response.Write("Over There");
lnkInsert.Enabled=false;
lnkMembers.Enabled=true;
InsertForm.Visible=true;
datagrid1.Visible=false;
}

..
</script>
<h1 align="center">The Club Members Table</h1>
<FORM id="form1" runat="server">
<center>
<asp:linkbutton id="lnkInsert" Runat="server" Font-Bold="True" Font-Size="Medium" OnClick="doInsert"
text="Insert Form" enabled="true"></asp:linkbutton>
<asp:linkbutton id="lnkMembers" Runat="server" Font-Bold="True" Font-Size="Medium" OnClick="doMembers"
text="View Members" enabled="false"></asp:linkbutton><br>
<br>
</center>
..
 
More on this problem. If I click on submit in the form and post the textbox values, not leaving the form, the lnkMembers becomes active and works. This is strange. lnkMembers did not work prior to clicking submit.
 
Not sure what is happening but you might want to set the enabled and visible properties programatically in your code behind since you are changing them programatically. It seems to me the InsertForm will never be visible. In short set up the visible and enabled in the !IsPostBack.
Marty
 
I changed the page load as listed below but still stuck in the form and can't activate the lnkMembers to move to the datagrid. GRRRRRRR...

void Page_Load(Object sender, EventArgs e)
{
if (! IsPostBack) {
bindDataGrid();
InsertForm.Visible=false;
datagrid1.Visible=true;
lnkMembers.Enabled=false;
lnkInsert.Enabled=true;
}
...

I'm not sure how to code the Visible and Enabled in the code behind.
 
Found the bug...A submit button was placed at the bottom of the form as listed below. After changing it to a LinkButton my lnkMembers link started working...

<asp:TableRow>
<asp:TableCell>
<asp:LinkButton ID="submit" OnClick="SubmitMember"
Text="Submit" Runat="server"></asp:LinkButton>
</asp:TableCell>
</asp:TableRow>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top