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
ajay raju
NA
398
0
java script function for selecting value into the textbox?
Jul 14 2010 6:23 AM
hi,
i am using datagrid to display user information and i take checkbox column into the datagrid and i take one textbox and textmode is multiline. i am taking contactname, mobileno...... etc columns to the datagrid.
my aim is when i select checkbox that row mobileNO value is display in Textbox and again i select another checkbox that row mobileNO is also display in textbox with comma seperation, and i deselect checkbox that row mobileNO is deleted from textbox.
how to write javascript function todo this. please give a sample code. i am not know how to write javascript functions
please give a solution
Thanks.
Reply
Answers (
3
)
0
Raghavendra U
715
1.3k
446.2k
Jul 14 2010 8:28 AM
ok,then change
document.getElementById("GVItems_ctl02_txtbx1").value to
document.getElementById("txtMobile").value
if not is works then send me your sample code.
0
ajay raju
0
398
0
Jul 14 2010 8:16 AM
hi Raghavendra,
thanks for your reply. i am not taken textbox in datagrid, i taken textbox in outside of the datagrid. please give that type of javascript code.
<asp:DataGrid............>
........................
</asp:DataGrid>
<asp:TextBox id="txtMobile" Textmode="MultiLine" runat="server"/>
Thanks.
0
Raghavendra U
715
1.3k
446.2k
Jul 14 2010 8:04 AM
hi ,
this is my grid
<asp:GridView ID="GVItems" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Column1">
<ItemTemplate>
<asp:TextBox ID="txtqty" runat="server" Text=""></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="ChkBox" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
write this in javascript function
if(document.getElementById("GVItems_ctl02_ChkBox").checked ==true)
{
document.getElementById("GVItems_ctl02_txtbx1").value="mobileno";
}
else
{
document.getElementById("GVItems_ctl02_txtbx1").value="";
}
"GVItems_ctl02_ChkBox" we find this in form right click select viewsource
"GVItems_ctl02_ChkBox" is the combination of GVItems id of gridview,ChkBox is Checkbox id in Grid and txtbx1 is TextBox id in grid.
ctl01 is the headerrow.
ctl02 is the first row rowindex in grid
ctl03 is the second row rowindex in grid
|
|
|
ctl10 is the tenth row rowindex in grid
|
|
|
ctl0n is the nth row rowindex in grid
i hope it heips you
Report Details Section Problem
Object tag render without Postback