473,382 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

trying to add a textbox column inside the datagrid

hey i am trying to put the textbox column inside the datagrid but i don't have any idea how to do that please any one help me with this
my code is like this:
[HTML]
<asp:datagrid id="garidreason" Width="650px" BorderStyle="Solid" BorderColor="Black" AlternatingItemStyle-BorderStyle="Dotted"
Runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="nominatedbyfirstname" HeaderText="Nominated by First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="nominatedbylastname" HeaderText="Nominated by Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeFirstName" HeaderText="Nominee First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Nomineelastname" HeaderText="Nominee Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Reason" HeaderText="Reason">
<HeaderStyle Font-Size="10pt" Font-Bold="True" Wrap="True" Width="450" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="datecreated" HeaderText="Date created">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
</Columns>
</asp:datagrid>
[/HTML]
Aug 30 '07 #1
1 1499
dip_developer
648 Expert 512MB
hey i am trying to put the textbox column inside the datagrid but i don't have any idea how to do that please any one help me with this
my code is like this:
[HTML]
<asp:datagrid id="garidreason" Width="650px" BorderStyle="Solid" BorderColor="Black" AlternatingItemStyle-BorderStyle="Dotted"
Runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="nominatedbyfirstname" HeaderText="Nominated by First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="nominatedbylastname" HeaderText="Nominated by Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="NomineeFirstName" HeaderText="Nominee First Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Nomineelastname" HeaderText="Nominee Last Name">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Reason" HeaderText="Reason">
<HeaderStyle Font-Size="10pt" Font-Bold="True" Wrap="True" Width="450" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="datecreated" HeaderText="Date created">
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="#316AC5"></HeaderStyle>
</asp:BoundColumn>
</Columns>
</asp:datagrid>
[/HTML]
add a Template column to your datagrid....now you can easily add textboxes to ItemTemplate or EditItemTemplate of your datagrid......
if your columns are databound columns then after making a databound column convert it to a Template column in the Property Builder window(there is a link below the window...."Covert this column into a template column")

your datagrid template column HTML will look like

Expand|Select|Wrap|Line Numbers
  1.  <Columns>
  2. <asp:TemplateColumn>
  3. <ItemTemplate>
  4. <asp:Label id=Label7 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Customer_ID") %>'>
  5. </asp:Label>
  6. </ItemTemplate>
  7. <EditItemTemplate>
  8. <asp:TextBox id=TextBox2 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Customer_ID") %>'>
  9. </asp:TextBox>
  10. </EditItemTemplate>
  11. </asp:TemplateColumn>
  12. </Columns>
Aug 31 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
2
by: Neo Geshel | last post by:
After pouring over about a dozen sites that clearly dealt with ClientID all by itself, I came to the realization that about 2/3+ of them were doing it wrong. It is indeed impossible to grab the...
19
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
2
by: Neo Geshel | last post by:
After pouring over about a dozen sites that clearly dealt with ClientID all by itself, I came to the realization that about 2/3+ of them were doing it wrong. It is indeed impossible to grab the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.