First of all I am not really good in english but Ill try to make it understandable as possible
So what I did was create a gridview wherein the column; two controls a label and a textbox label is set to be visible while textbox is vice versa
here is the client-code of my gridview
<asp:Image ID="img" onclick="javascript:Toggle(this);" runat="server" ImageUrl="~/Images/minus.gif"
ToolTip="Collapse" Width="7px" Height="7px" ImageAlign="AbsMiddle" /></a>
<asp:Label ID="lbllastname" Height="15px" Width="180px" runat="server" Text='<%# Eval("CourseCatName")%>'></asp:Label>
<asp:TextBox ID="txtCourseCategory" AutoPostBack="true" runat="server" Text='<%# Eval("CourseCatName")%>'
Font-Size="XX-Small" Font-Names="Verdana" Style="display: none" OnTextChanged="txtCourseCategory_TextChanged"
Height="16px" Width="207px"></asp:TextBox><br />
I know that it is difficult to find control inside a gridview so what i did is create a atrribute on my server side to be passed on my javascript function Here is what I did
Dim txttry As TextBox = DirectCast(e.Row.FindControl("txtCourseCategory"), TextBox)
Dim labeltry As Label = DirectCast(e.Row.FindControl("lbllastname"), Label)
labeltry.Attributes.Add("onclick", "javascript:return validate('" + txttry.ClientID + "','" + labeltry.ClientID + "')")
And on my javascript ive created a function to call the controls
function validate(txtobj, lblobj) {
document.getElementById(lblobj).style.display = 'none';
document.getElementById(txtobj).style.display = 'block';
}
So that code works and I think it is almost done but when I run my program and click on the label;
the label hides but the textbox is below like there is a <br/> between then
I check the codes again but found nothing that could make the textbox below.
Sir/Madam what do you think is the problem or should I add a CSS for it?
Or my code is the huge problem?
I am open for suggestion be it bad or good.
By the way I am really new on javascript
Thanks for your time and effort trying to read my problem.