TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dina
NA
51
0
Unable to make validation in textboxes being located in EditItemTemplate
Sep 22 2010 8:11 PM
Hi All guys,
I want to make Validation (using javascript) on TextBox that is found in EditItemTemplate of gridview to force the user not to enter blank value
I just wrote :
<script type="text/javascript" language="javascript">
function
validateTextBox()
{
var textElem=document.getElementById('txtname');
if(textElem.value==' '){
alert("You must enter value");
return false;
}
else{
return true;
}
}
</script>
<TemlateField>
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtname"></TextBox>
</TemlateField>
</EditItemTemplate>
<TemlateField>
<EditItemTemplate>
<asp:Button runat="server" OnClick="
btnupdate_Click"
onClientClick=
"
return validateTextBox()"
ID="btnupdate" Text="Update Name"></Button>
</TemlateField>
</EditItemTemplate>
this code neither call serverside function nor clientside.
I tried to get access to update button in RowDataBound Event and wrote:
btnupdate.Attributes.Add("onclick",return ValidateTextBox()");
but it seems that RowDataBound Event returns the rows that are in normal state only not in edit state
Any Suggestions would be too much appreciated
Reply
Answers (
8
)
program in .net
Dynamically Created Button Click Event