C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to create DataGrid ItemTemplete Columns using VB.NET


Posted Date: 03 Jan 2008    Resource Type: Code Snippets    Category: ASP.NET GridView

Posted By: Polash Karmakar Apurba       Member Level: Bronze
Rating:     Points: 10



How to create DataGrid ItemTemplete Columns using VB.NET


<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 128px; POSITION: absolute; TOP: 56px"
runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderWidth="1px"
BorderStyle="Solid" CellPadding="3" GridLines="Vertical" ForeColor="Black" Height="120px">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#000099"></SelectedItemStyle>
<AlternatingItemStyle BackColor="#CCCCCC"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="Black"></HeaderStyle>
<FooterStyle BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="ProductID" HeaderText="ProductID"></asp:BoundColumn>
<asp:BoundColumn DataField="ProductName" HeaderText="ProductName"></asp:BoundColumn>
<asp:BoundColumn DataField="UnitPrice" HeaderText="UnitPrice"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Discontinued">
<ItemTemplate>
<asp:CheckBox id="CheckBox1" runat="server" Checked='<%# DataBinder.Eval(Container.DataItem,"Discontinued") %>' >
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999"></PagerStyle>
</asp:DataGrid></form>
----------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim obcon As New SqlClient.SqlConnection("server=ws3;database=Northwind;uid=sa;pwd=sa")
Dim da As New SqlClient.SqlDataAdapter("SET ROWCOUNT 10 select* from Products", obcon)
Dim dt As New DataTable
da.Fill(dt)
DataGrid1.DataSource = dt
DataGrid1.DataBind()


End Sub





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
VB.NET  .  Using  .  DataGrid ItemTemplete  .  Columns  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Different types of DataGrid Event
Previous Resource: Add Templete field in Grid
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET GridView


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use