473,394 Members | 1,748 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,394 software developers and data experts.

client side and server side with datagrid

hi,

My program is going like that:
-choose criteria from dropdownlist
-press on submit bottun
-the results are display in datagrid

Now, here is the problem:
i need to display 4 different datagrids but i only have one on my aspx
file.

i tried to build a dynamic datagrid but couldn't find how to do
that.

i know there is a lot of info at the net but i wasn't able to
understand how to take the datatable with my data and change it to my
datagrid format.
im using c#.
I hope you will be able to help me because im about to give up.
or maybe there is other way to do that????????

this is the datagrid format:

<asp:datagrid id="DataGridRresults" runat="server"
OnPageIndexChanged="DataGridRresults_PageIndexChan ged"
BorderStyle="Solid" ShowFooter="True" AllowPaging="True"
BackColor="White" PageSize="5" ForeColor="Black" GridLines="Vertical"
BorderWidth="1px" BorderColor="#999999" CellPadding="3"
HorizontalAlign="Center" AutoGenerateColumns="False">
<FooterStyle BackColor="#CCCCCC"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#000099"></SelectedItemStyle> <AlternatingItemStyle
BackColor="#CCCCCC"></AlternatingItemStyle>
<ItemStyle Wrap="False" HorizontalAlign="Center"
VerticalAlign="Top"></ItemStyle>
<HeaderStyle Font-Bold="True" Wrap="False" HorizontalAlign="Center"
ForeColor="White" VerticalAlign="Middle"
BackColor="Black"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="Company Name">
<ItemTemplate>
<a HREF='' onClick='window.open("<%#
Convert.ToString(DataBinder.Eval(Container.DataIte m, "url"))%>",
"_blank",
"width=730,height=500,menubar=no,location=no,toolb ar=no,status=yes,scrollbars=yes,resizable=yes");re turn
false;'><%# DataBinder.Eval(Container.DataItem, "Topic")%>
</a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="E-Mail">
<ItemStyle VerticalAlign="Top"></ItemStyle>
<ItemTemplate>
<B>
<%# DataBinder.Eval(Container.DataItem, "Companyname") %>
</B>
<BR>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Business Phone">
<ItemStyle VerticalAlign="Top"></ItemStyle>
<ItemTemplate>
<B>
<%# DataBinder.Eval(Container.DataItem, "BusinessPhone") %>
</B>
<BR>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Mobile Phone">
<ItemStyle VerticalAlign="Top"></ItemStyle>
<ItemTemplate>
<B>
<%# DataBinder.Eval(Container.DataItem, "MobilePhone") %>
</B>
<BR>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:datagrid>

thanks
nurit

Nov 19 '05 #1
1 1037
i found the answer for me. if any one wants to know its goes like that:
codebehind:

BoundColumn col = new BoundColumn();

for (int i=0; i<DTcolumns.Length;i++)
{
col = new BoundColumn();
col.DataField = DTcolumns[i];
col.HeaderText = DTcolumns[i];
DataGridRresults.Columns.Add(col);
}

DataGridRresults.DataSource = workTable;
DataGridRresults.DataBind();
DataGridRresults.Visible=true;

aspx file:

<asp:datagrid id="DataGridRresults" runat="server"
OnPageIndexChanged="DataGridRresults_PageIndexChan ged"
BorderStyle="Solid" ShowFooter="True" AllowPaging="True"
BackColor="White" PageSize="5" ForeColor="Black"
GridLines="Vertical" BorderWidth="1px" BorderColor="#999999"
CellPadding="3" HorizontalAlign="Center"
AutoGenerateColumns="False">
<FooterStyle BackColor="#CCCCCC"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#000099"></SelectedItemStyle>
<AlternatingItemStyle
BackColor="#CCCCCC"></AlternatingItemStyle>
<ItemStyle Wrap="False" HorizontalAlign="Center"
VerticalAlign="Top"></ItemStyle>
<HeaderStyle Font-Bold="True" Wrap="False"
HorizontalAlign="Center" ForeColor="White" VerticalAlign="Middle"
BackColor="Black"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="Company Name">
<ItemTemplate>
<a HREF=''
onClick='window.open("<%#
Convert.ToString(DataBinder.Eval(Container.DataIte m, "url"))%>",
"_blank","width=730,height=500,menubar=no,location =no,toolbar=no,status=yes,scrollb*ars=yes,resizabl e=yes");return
false;'>
<%# DataBinder.Eval(Container.DataItem, "Topic")%>
</a>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:datagrid>

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jon | last post by:
Can you add client side controls inside a asp .net datagrid? The code below shows what I have template column inside a asp .net datagrid... <Columns> <asp:TemplateColumn HeaderText="Exist Or...
2
by: cedced | last post by:
Hello, is it possible to access client files in VB.NET? What? I have doing that but it isn't good (VB.NET take file on pc server and not on pc client): (thanks) Dim fichier As StreamReader ...
4
by: Sue | last post by:
ASP.NET web application, data grid with several fields (Labels), table below the datagrid with several textboxes and dropdown lookup tables. When a user clicks on the "Select" button in datagrid,...
8
by: Sue | last post by:
I have a datagrid populated with 6 visible read-only labels and several hidden fields. Below the datagrid, I have a table with various textboxes, dropdowns, etc. I've managed to decypher the...
8
by: Mike Fellows | last post by:
Ok, im not sure if this is at all possible and if it is how i go about it is beyond me i have a piece of client side code that requires a piece of data from the server side (an ID number in this...
5
by: rodchar | last post by:
hey all, i have a datagrid with checkboxes on it and i was wondering if i can do the following: if a user clicks on the checkbox it makes a server-side button visible. can i make this happen...
7
by: Rémi | last post by:
Hello. I have just gotten a client-side delete confirmation Javascript button to work, using this FAQ question as a basis (3rd question down, URL...
2
by: Maarten | last post by:
Hi all, I have a datagrid with questions where the user has to make a choice (yes or no questions) But for some questions there are rules, like if you choose (yes or no) for some questions I...
0
by: Reena | last post by:
Hi, Working with ASP.NET 2.0 with Masterpages. Here is my datagrid... <asp:DataGrid ID="dgSelectedFields" runat="server" BorderStyle=None GridLines="None" CssClass="grdData"
1
by: Andrew Wan | last post by:
Is it possible to make some of the DataGrid functionality to client-side? Such as the Edit, Update, Cancel, Delete functionality? Everytime I click on a row's Edit button, I wait 2 seconds...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.