Forms Data Controls :: Dynamically Alter The Page Size In A Paged Gridview Based On Data In A Particular Column?

Dec 14, 2010

I've already searched to no avail for an answer to this question:is it possible to dynamically alter the page size in a paged gridview based on data in a particular column?In other words,let's say I get data from a table that lists students enrolled in a particular course.If there are 10 students in Course "A," then I want page 1 in my gridview to show 10 records.

If there are 15 students in Course "B," then I want page 2 in my gridview to show those 15 records,and so on.I imagine that this could probably be done with a master-detail kind of set up,but let's say for the sake of argument that I don't want to go that route.

View 4 Replies

Similar Messages:

Data Controls :: Dynamically Show Hide Label And HyperLink Based On Condition In Same Column Of GridView

May 7, 2015

I am checking string  and then bind category. If condition is false then i  need anchor tag in which i pass querystring to specific link.

<asp:Literal runat="server" ID="litPrice" Text='<%#((String.IsNullOrEmpty(Eval("Price").ToString()) || Eval("Price").ToString()=="00/0.00" || Eval("Price").ToString()=="0/0.00") ? "<span font-family="arial"><a href=""+ Eval("category")>Enquiry</a></span>" : Eval("Price"))%>' >

I am getting error. CS1010: Newline in constant

View 1 Replies

Forms Data Controls :: How To Set Specific Width Size On Gridview Column

Mar 15, 2011

I want to set specific width size of a column inside grid view i tryed following things butit did not work:

I tryed through css through C# and to set properties for gridview like itemstyle/itemcontrol width = 150px

View 7 Replies

Forms Data Controls :: How To Add A Hyperlink In A New Column On A GridView Based On A Data Table

Dec 18, 2010

I have created a gridView control and have successfully bound DataTable (dt) to it using


However, I want to add a dynamic hyperlink that will take the user somewhere based on the value of one of the columns in the selected row. I'm not sure how to do that.

View 4 Replies

Web Forms :: Dynamically Changing Size Of Content Placeholder Based On Browser Size?

Oct 14, 2010

I know the content palcehlder does not have a size ,I have a masterpage and content page, the master page has a table with a header, content area, and footer, header and footer are fixed size, content area is 100%. As the user sizes the browser the content area grows and shrinks and the footer stays at the
bottom of the browser window - perfect!

Problem: The contentpalceholder does not grow to fill the available content area. Now, the contentplaceholder gets its size from its contents, which in this case is a div holding a silverlight object.I was thinking I could hook the master or child page's re-size event and somehow pass that info onto the SL object, but as it turns out (and I'm surprised I never knew this) there is no page re-size event! (really?, wow.)

So is there a way to get a SL object hosted on a master page to size itself based on the size of the browser window?Or more generally, a way to size the contents (like a div or panel) of a contentplaceholder based on the browser? on a standard aspx page (not a master page) I CAN get the SL object to size itself based on the broswer, the problem seems to come from the fact that I'm hosting the SL object in a content placeholder.

I guess I could 'unroll' the master page into several standalone pages and have it work, but the menu is on the master page and I'm used to using them, plus it's already done...<sigh>

View 1 Replies

Data Controls :: Change Value Of GridView BoundField Column Based On Value From Another Column

May 7, 2015

I am using item template and eval function in the gridview to display the records. Can I add a coulmn which is not in the table?

I have to add some columns which is not in the table and assign the values from code behind to that particular column

View 1 Replies

Forms Data Controls :: Finding Pages In A Paged GridView

May 27, 2010

I have a gridview that is a directory of people with about 50 pages

How would I make another gridview that had first row with 26 columns, 1 for each letter of the

alphabet and second row with the first page that has last names that start with that letter.

View 6 Replies

Setting The Column Size Based On The Max Column Size In The Table?

Jul 13, 2010

I want to set the coulms size of all the columns in the table in the DB based on the maximum width/size of one of those columns of that particular table That is if I have three columns Name(nvarchar 50), Address(nvarchar 70) and Description(nvarchar 100), then I want Name and Address to also be nvarchar 100, can anyone give me the code for the same in VB.

View 1 Replies

Forms Data Controls :: How To Highlight A Gridview Row Based On Column Value

Feb 11, 2010

I have a Gridview with two columns name and email.

Now if the employee does not have an email address then I would like to highlight that row.

How can i achieve that?

View 1 Replies

Forms Data Controls :: How To Get Column And Design In Gridview Dynamic Based On Value

Nov 18, 2010

I need to generate gridview based on table value... let us consider i have in my aspx page one dropdownlist in which i have binded somevalefor example: dropdownlist contain:- Item1 based on Item1 i have three table first table conists A,B,C,D value. Second Table consist 1,2,3,4,5 Third Table consist (0.5,0.6,0.7) for 1, (0.7,1.0) for 2, (0.6) for 3, (0.8) for 4, and another(0.8) for 5 based on this three table i need to show girdview like this which is below If its Item2 dropdownlist then row and column of girdview will be any number based on first,second,third table value for Item2like this if Item3 dropdownlist then row and column of girdview will be any number based on first,second,third table value for me to achieve dynamic rows and column based on database value... in C#....

View 14 Replies

Forms Data Controls :: Add Column To A Gridview Dynamically?

Jun 27, 2010

So I take all my current query and through it into my gridview and it works great. What I need to do is grab some data from antoher query and add on columns if anything exists in the data. How can i create columns dynamically and add them onto my existing gridview if data exists.

Sql = Select intMetricId, strBenchmarkName, intBenchmark from tblbenchmark.
myDataTable = New DataTable
myDatatable = GetData(sql)
mygridview.Datasource = mydatatable

So strBenchmarkName would be the new column heading name and then all the 12 rows of data would be the inbenchmark if any exists.

How can i new columns on an existing gridview if anything exists in the datasource.

View 6 Replies

Forms Data Controls :: Checkbox Selection Based On Group Column Values In Gridview?

Jul 28, 2010

I have to select checkboxes besed on group column values. If you see below gridview, column 3 (GroupN) has 1,1,1,1,2,2,2,2....etc (this column data is not static, will change based on page index. i.e PageIndex =2 may starts with 7,7,7,8,8,8,8,8,9,9,9 etc).

Now My question is.

1). If user selected '1', we have to store value and user must and should select another '1' (atleast two times).

2) If user selected '1', and user trying select '2'. Giving error says "Must have select one then one record in group to combine' (will not allow) and unselect '2'.

3) If user selected '1' atleast two times, and user trying select '2'. Will allow.

4) If user selected '1' atleast two times and selected '2' one time, trying to select '3'. will not allow user to select '3'.

View 3 Replies

Forms Data Controls :: Display Some Xml Tags In Gridview Dynamically Based On User Selection?

Jul 17, 2010

i have displayed a xml file in the tree view form by binding i want a sample code to access the nodes which are being selected and to display dynamically in a grid view

View 4 Replies

Forms Data Controls :: Using Gridview - Alter EmptyDataText Results

Jul 10, 2010

I am working on a site using .aspx controls. Currently I am working on a search feature which searches my database of records and produces all applicable results to the search. Everything works as planned. I have recently added the EmptyDataText line to produce a specific output anytime no results are found in the database. However, I would like to be able to alter/change the appearance of the EmptyDataText output and cannot figure out how to do so. For example, if no results are returned from the search, I would like the EmptyDataText to produce an output of something along the lines of "Your search has produced zero results.

double check your spelling and try your search again." I would like to change the font color, font size, and possibly the thin box which is automatically produced around this output. Is any of this possible? If not, is there another way to produce the desired results? Ultimately, I would actually like to have the results actually use the terms which were input to the search within the EmptyDataText results when no search results are found within my database. For example, if "widget" was used as a search term and "widget" was not found within my database then i would like the results page to state something along the lines of: "Your search for 'widgets' did not return any results. check the spelling and try your search again." Does anyone know how to do any of these things using ASP.Net?

View 1 Replies

Forms Data Controls :: Dynamically Adjusting Gridview Column Width?

Oct 3, 2010

I populate a gridview dynamically which has differen column numbers depend on requirements. My goal is to adjust column width dynamically. I have tried several methods and events, then RowCreated event of GridView looks best one to do. My code is as below. When
i check result at the ViewSource on the browser, i can see that width of <td> successfully adjusted. BUT nothing changes on the browser, column width always as wide as text?

My Code [Code]....


View 5 Replies

Forms Data Controls :: Sorting Not Available In A Dynamically Binded Column Of A GridView?

Jun 21, 2010

I have a auto column generated GridView in a page, I have a dynamically binded column in that gridview, when page loads then sorting option is available on all other columns except that dynamically created column.


View 1 Replies

Forms Data Controls :: Change The Column Name Of Gridview Dynamically At Runtime?

Jan 14, 2011

My issue is that , need to change the column name(following some format) of the gridview (which is binded with XMLTextReader). Without changing directly XML file, Required to change the column name dynamically at runtime .



Heading S0015 S0020 S0025 S0030 S0035
FS 1 2 4 5 6
BS 0 3 5 1 3
Required Format:

Heading 00:15 00:20 00:25 00:30 00:35
FS 1 2 4 5 6
BS 0 3 5 1 3

View 6 Replies

Forms Data Controls :: Dynamic Gridview With Dropdownlist / Dynamically Set The List Values Based On Parameters (of The Row They Are On)

May 28, 2010

I'm new to web dev and c# so please bare with me. I am trying to create a dynamic gridview in a web form for users to to answer questions with (code below).

The dificulty im having is that i am nesting a dropdwonlist in the gridview and want to be able to dynamically set the list values based on parameters (of the row they are on). These values are in the main dataset for the gridview as each row represents a questionid and question text and then a ddl for the criteria...

I just don't know how to set the values for the dropdown all the code so far is below... just need to be able to populate the dropdowns with the relevant values.

I have created a stored proc to return the different criteria based on the questionid and questionGroupid which is the dataset that populates the other fields in the gridview: dbo.usp_QuestionCriteria @QuestionGroupId, @QuestionId

I have added this as a tableadapter called criteriaTableAdapter in a xsd file as well using the wizard... not sure if this is the right option though or just use the same method as i have for the other stored procedure as in the code below:


]using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Sql"].ConnectionString);
SqlCommand com = new SqlCommand("usp_QuestionGroupDS", con);
com.CommandType = CommandType.StoredProcedure;
SqlDataAdapter ada = new SqlDataAdapter(com);
DataSet ds = new DataSet();
for (int i = 0; i < ds.Tables.Count; i++)
if (ds.Tables[i].Rows.Count > 0)
GridView gvDynamicQuestion = new GridView();
gvDynamicQuestion.Width = Unit.Pixel(700);
gvDynamicQuestion.BorderWidth = Unit.Pixel(0);
gvDynamicQuestion.Caption = "<div id="nifty" class="QuestionGroup"> <b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>" + ds.Tables[i].Rows[0]["Category"].ToString() + " Questions<b class="rbottom"><b
class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b></div>";
gvDynamicQuestion.AutoGenerateColumns = false;
gvDynamicQuestion.ShowFooter = true;
TemplateField tf = null;
tf = new TemplateField();
tf.HeaderTemplate = new DynamicGridViewTextTemplate("QuestionId", DataControlRowType.Header);
tf.ItemTemplate = new DynamicGridViewTextTemplate("QuestionId", DataControlRowType.DataRow);
tf.FooterTemplate = new DynamicGridViewTextTemplate(DataControlRowType.Footer, ds.Tables[i].Rows.Count);
tf = new TemplateField();
tf.HeaderTemplate = new DynamicGridViewTextTemplate("Question", DataControlRowType.Header);
tf.ItemTemplate = new DynamicGridViewTextTemplate("Question", DataControlRowType.DataRow);
tf = new TemplateField();
tf.HeaderText = "Criteria";
tf.HeaderTemplate = new DynamicGridViewTextTemplate("Criteria", DataControlRowType.Header);
tf.ItemTemplate = new DynamicGridViewDDLTemplate();
////tf = new TemplateField();
////tf.HeaderText = "Criteria";
////tf.ItemTemplate = new DynamicGridViewDDLTemplate();
gvDynamicQuestion.DataSource = ds.Tables[i];
protected void DynamicGrid_RowDataBound(object sender, GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.Footer)
public class DynamicGridViewTextTemplate : ITemplate
string _ColName;
DataControlRowType _rowType;
int _Count;
public DynamicGridViewTextTemplate(string ColName, DataControlRowType RowType)
_ColName = ColName;
_rowType = RowType;
public DynamicGridViewTextTemplate(DataControlRowType RowType, int QuestionCount)
_rowType = RowType;
_Count = QuestionCount;
public void InstantiateIn(System.Web.UI.Control container)
switch (_rowType)
case DataControlRowType.Header:
Literal lc = new Literal();
lc.Text = "<b>" + _ColName + "</b>";
case DataControlRowType.DataRow:
Label lbl = new Label();
lbl.DataBinding += new EventHandler(this.lbl_DataBind);
case DataControlRowType.Footer:
Literal flc = new Literal();
flc.Text = "<b>Total No of Questions:" + _Count + "</b>";
private void lbl_DataBind(Object sender, EventArgs e)
Label lbl = (Label)sender;
GridViewRow row = (GridViewRow)lbl.NamingContainer;
lbl.Text =DataBinder.Eval(row.DataItem, _ColName).ToString();
public class DynamicGridViewDDLTemplate : ITemplate
// Implementation of ITemplate
public void InstantiateIn(System.Web.UI.Control container)
// Create a DDL
DropDownList ddl = new DropDownList();
//Attach method to delegate
ddl.DataBinding += new System.EventHandler(this.ddl_DataBind);
//Method that responds to the DataBinding event
private void ddl_DataBind(object sender, System.EventArgs e)
//DropDownList ddl = (DropDownList)sender;
//DataGridItem container = (DataGridItem)ddl.NamingContainer;
//ddl.Data.Checked = [Data binding expression];


View 7 Replies

Forms Data Controls :: Adding Linkbutton Field As Column In Gridview Dynamically?

Mar 24, 2011

am binding a gridview to datatable ...and now i want to add a linkbutton/hyperlink as one of the columns in gridview (similar to checkbox field) adding the Lbtn inside a template field ,but i want that column to come as last column ..but its coming as first column,,,how to acheive that??

moreover ,whn i clk on eack linkbutton a pop-up window has to come with submit and save and close buttons and functionality(is it better to use linkbutton or hyperlink??) using vs 2005

View 3 Replies

Forms Data Controls :: Create Hyperlink Column In A Dynamically Created Gridview?

Aug 18, 2010

I am dynamically creating my grid view as:

HyperLinkColum hlc = new HyperLinkColum();
hlc.Datatext.DataTextField = "PK";

I wanted to call a page say "test.aspx" and to send the primary key of the relevant row to the "test.aspx" page and then how to retrieve this values in the "test.aspx" page

View 4 Replies

Data Controls :: Sort GridView Based On Column Name Specified In Selected Radio Button

Jan 4, 2013

i need to sort the gridview based on the radiobuttons. and i have 3 radiobuttons like dept,empcode,reporter..

if i click on any of radiobutton i need to show the gridview by sorting order..

View 1 Replies

Data Controls :: Dynamically Add Control To TemplateField Column Of GridView?

Jan 31, 2014

I am trying to dynamically create radio buttons based on one of the grid column. If the grid  has four rows, it means that there are 4 time slots in the time column and I need to display 4 radio buttons after click of a button on the page. I am able to display radio buttons but dont know how to display dynamically based on grid

View 1 Replies

Data Controls :: How To Make Event Of GridView Column Dynamically

May 7, 2015

i have made a gridview which contains three fields, two textboxes and one combo box. ComboBox fetchs data from table(SQL) and when a combox box triggers, data related to combo must be added in two boxes. i did this throw another button, but i want this to be trigger directly when it clicks.

View 1 Replies

Forms Data Controls :: Dynamically Change The Size Of An Image?

Dec 5, 2010

why the following instruction does not work?

<asp:Image runat="server" ImageUrl="Imageslue.gif" Width="30" Height='<%# Eval("Numero") %>'> </asp:Image>

View 2 Replies

Data Controls :: Dynamically Add Panel To GridView Template Field Column

Jan 23, 2014

Below is the gridview with 3 columns and column 1 has panel scrollbar for each item/row:

Column 1 | Column 2 | Column 3
12345 ↑ | |
14323 | |
43345 | |
45678 | |
↓ | |

3333 ↑ | |
32123 | |
544444 | |
99088 | |

↓ |

The code on aspx is working well, but I don't want to use it in aspx.

<HeaderStyle Width ="215px" Font-Names ="Tahoma" Font-Size ="9pt" />
<ItemStyle Width ="215px" />

[Code] ....

So,  I have a datatable in codebehind show as :

 Private Sub GetNumbers()
'Create Table Manually
Dim dt As New DataTable()
'Add Columns to DataTable
dt.Columns.Add("Column 1", GetType(String))

[Code] .....

How to add  dynamically <asp:panel>  scrollbar for the Column1  in the code behind.

View 1 Replies

Copyrights 2005-15, All rights reserved