gridview

How to bind the URL of a GridView HyperLinkField when the bound value contains a colon?

瘦欲@ 提交于 2019-12-19 06:46:46
问题 I'm trying to bind a GridView HyperLinkField such that the bound column is used as a parameter value in the URL. Pretty standard stuff - nothing fancy, but the binding fails when the bound column contains a colon, i.e. : . I'm my particular case, this value is a string representing a duration of time, e.g. "14:35", or "1:07:19". Here's my GridView, with the time value bound to the HyperLinkField url. <asp:GridView ID="ResultsGridView" runat="server" AutoGenerateColumns="False" DataSourceID=

GridView loses data during postback

久未见 提交于 2019-12-19 06:40:23
问题 I have an aspx.Page containing a gridview. The gridview is bound in code behind to a datasource only when no postback takes place and has enableviewstate = true (The page too). During a postback, the data bound to the gridview are lost. What could be the reason. Please ask if code is needed. 回答1: Solved it, problem was I made a Page.Databind() in the Page_Load event of the masterpage of the page with the gridview, so it bound the gridview during each postback without data. Thanks for all

How to fix "'ddlAssignedTo' has a SelectedValue which is invalid because it does not exist in the list of items

烈酒焚心 提交于 2019-12-19 06:39:30
问题 I load the gridview and the gridview has an edit and delete buttons. I click on Edit and I get, " ddlAssignedTo' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value I know that I am getting this error because the value fo ddlAssignedTo is null - nothing exists on the db for ddlAssignedTo. All I was trying to do is update the current value. So, my issue is this, if the current value is null, how do I assign a default value for

How to Set a gridview column width when binding to a datatable

二次信任 提交于 2019-12-19 06:01:24
问题 I am binding a table to a gridview in asp.net as such grdIssues.DataSource = mdtIssues; grdIssues.DataBind(); The problem is I cannot then control the column width, asp.net seems to decided on it's own what width each column should be. Methods such as grdIssues.Columns[0].ItemStyle.Width = 100; grdIssues.Columns[1].ItemStyle.Width = 100; don't work because the columns are created dynamically. I cannot believe there isn't a way to do this short of manually creating each column and filling each

Get the absolute row number in a grid

让人想犯罪 __ 提交于 2019-12-19 05:53:05
问题 In yii's CGridView I can get the current row number by using $row . But this returns the row index within the current page only. What I really need is to get the absolute row number among all pages. I am using yii, so my dreams should come true "easily", so I expect the answer should not guide me to add a special field to the data provider or access the pager and get the current page number and then multiply numbers bla bla bla. Thanks 回答1: Have you solved this? If not, I offer you the

How to rid of empty div that contains a GridView

点点圈 提交于 2019-12-19 05:46:14
问题 In ASP.NET Gridviews generate a table which generates a parent div container. This can break CSS layouts since there is no way to attach styles to the generated div. Is there a way to prevent the div from generating or a way to apply a style to it? This was asked and marked as resolved here but MS just said that the div is needed for the Paging and Sorting functionality. Am I to understand that if I want to use the paging and sorting functionality I can't wrap my own div around it and apply a

How do I specify CSS classes for specific rows in a GridView?

依然范特西╮ 提交于 2019-12-19 05:44:14
问题 I am creating a SharePoint web part in C# and part of it outputs a GridView control to the page. While I can get fairly extensive control over the way it is displayed by setting the CSS class of the GridView itself, what I would really like to do is be able to specify classes to certain specific td elements. I'm not sure how to go about doing this, or if it would be done at the time that the GridView is being populated with rows, or at the time the GridView is added to the page. In pseudocode

CheckBoxField columns in ASP.NET GridView are disabled even if ReadOnly set to false

六月ゝ 毕业季﹏ 提交于 2019-12-19 05:04:51
问题 I have a GridView with two CheckBoxField columns. They both have ReadOnly property set to false, but html code generated for them has attribute disabled="disabled". So the value cannot be changed. Generated HTML example: <span disabled="disabled"><input id="ctl00_ContentBody_GridView_ctl02_ctl01" type="checkbox" name="ctl00$ContentBody$GridView$ctl02$ctl01" checked="checked" disabled="disabled" /></span> Can anybody say how to figure it out? 回答1: This is by design; rows in a GridView are not

CheckBoxField columns in ASP.NET GridView are disabled even if ReadOnly set to false

筅森魡賤 提交于 2019-12-19 05:04:23
问题 I have a GridView with two CheckBoxField columns. They both have ReadOnly property set to false, but html code generated for them has attribute disabled="disabled". So the value cannot be changed. Generated HTML example: <span disabled="disabled"><input id="ctl00_ContentBody_GridView_ctl02_ctl01" type="checkbox" name="ctl00$ContentBody$GridView$ctl02$ctl01" checked="checked" disabled="disabled" /></span> Can anybody say how to figure it out? 回答1: This is by design; rows in a GridView are not

How to set ellipses on a column data if it exceeds more than a set record

你说的曾经没有我的故事 提交于 2019-12-19 04:46:25
问题 How to set ellipses on a column data I have the following BoundField in my GridView: <asp:BoundField DataField="Provider" HeaderText="Provider" ItemStyle-VerticalAlign="Top" ItemStyle-CssClass="hideText" ItemStyle-Width="100" /> It is populated from a sql query and displays like this (the smudged out data is all the provider returned from the result): I am populating the data from code-behind (partial code): int rowcounter = 0; SPListItemCollection collListItems = list.GetItems(oQuery);