gridview

Can data be kept in a dynamically bound GridView's invisible fields?

大兔子大兔子 提交于 2020-01-05 08:24:12
问题 I have a query expression which I am binding to a GridView in Page_Load. The data I want to capture in the SelectedIndexChaned event is in a BoundField defined thus: <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID" Visible="False" /> If I set Visible="True", I have no trouble getting this data. Is there a way to hide the ID field and still get the data? 回答1: Depends on how you are trying to get the data. If this is an ID field that is unique for each row in

Remove EmptyDataTemplate border

让人想犯罪 __ 提交于 2020-01-05 08:00:54
问题 I have a GridView in ASP.NET with custom CSS styling, including a border. The EmptyItemTemplate has a message: "No results found" but has a border which I want to remove. I know about this code: <EmptyDataRowStyle BorderWidth="0" /> However, this applies to the row, not the table itself--so the table border remains. I've also tried applying a custom CSS class to the EmptyDataRowStyle, but this applies to the row, not the table itself. So how do I remove the border on the EmptyDataTemplate?

How to find textbox in GridView using javascript function fired on “Onclientsideselectedindexchanged” of a radcombobox in same GridView RSS

旧巷老猫 提交于 2020-01-05 07:51:28
问题 I have two controls a TextBox and a radcombobox in ItemTemplate of a GridView. What I want to do is when the event onclientsideselectedindexchanges of radcombobox is fired. I want to show/Hide the TextBox on client side with JavaScript. Basic purpose of this is to avoid post back to show the TextBox which will be DataBound to database. If it is not possible to do on the client-side, then please suggest some alternative on server side. 回答1: In my example, I have a GridView with a template

Return Gridview Checkbox boolean

无人久伴 提交于 2020-01-05 07:37:04
问题 I've racked my brains on trying to access the ID column of a gridview where a user selects a checkbox: <asp:GridView ID="gvUserFiles" runat="server"> <Columns> <asp:TemplateField HeaderText="Select" ItemStyle-HorizontalAlign="Center" > <ItemTemplate> <asp:CheckBox ID="chkSelect" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> The gridview columns are chkSelect (checkbox), Id, fileName, CreateDate When a user checks a checkbox, and presses a button, i want to

Return Gridview Checkbox boolean

馋奶兔 提交于 2020-01-05 07:36:11
问题 I've racked my brains on trying to access the ID column of a gridview where a user selects a checkbox: <asp:GridView ID="gvUserFiles" runat="server"> <Columns> <asp:TemplateField HeaderText="Select" ItemStyle-HorizontalAlign="Center" > <ItemTemplate> <asp:CheckBox ID="chkSelect" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> The gridview columns are chkSelect (checkbox), Id, fileName, CreateDate When a user checks a checkbox, and presses a button, i want to

Export to Excel from gridview

柔情痞子 提交于 2020-01-05 07:28:08
问题 I have code for exporting to Excel. In my gridview I set paging to display the number of records in pagecount. But in my export to Excel it is not giving me entire records, instead it is showing me the same paging with six records. My code: string attachment = "attachment; filename=Contacts.xls"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/ms-excel"; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new

Localize currency values in WPF GridView with different cultures for each row based on XAML bindings to culture name property

可紊 提交于 2020-01-05 07:27:51
问题 First time poster here but have been reading SO for ages and finally have run into a question that I've not been able to answer. I've got a ListView hosting a GridView with multiple columns. One displays a price and another displays a currency code (CAD, USD, GBP, etc). This is all pulled out of SQL server using Entity Framework so the GridView is databound to a IEnumerable which stores the result of my query. The currency code is stored in a separate table with a localization string (en-US,

viewPager.setPageTransformer slows down the viewPager scrolling

耗尽温柔 提交于 2020-01-05 07:27:35
问题 Please anyone help me. when i add vp1.setPageTransformer(true, new ZoomOutPageTransformer()); to my Viewpager then viewpager getting slow scroll. if i remove animation it works fine... And when i scroll to the next page of viewPager means next Fragment then in that Fragment GridView not scrolls. Here is the code... vp1 = (ViewPager) view.findViewById(R.id.vp1); vp1.setPageTransformer(true, new ZoomOutPageTransformer()); int offScreen = 5; vp1.setOffscreenPageLimit(offScreen); postion =

ASP.NET - Problem with GridView with Dynamic Columns

这一生的挚爱 提交于 2020-01-05 04:49:44
问题 I have a GridView that includes BoundField and TemplateField elements. Some of the TemplateField elements are dynamically generated. For the sake of reference, here is the GridView that I am using <asp:GridView ID="myGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" ShowFooter="True" EnableModelValidation="True" OnLoad="myGridView_Load" OnRowCommand="myGridView_RowCommand" OnRowEditing="myGridView_RowEditing" OnRowDeleting="myGridView_RowDeleting" OnRowCancelingEdit=

Need a javascript to enable or disable the check box

廉价感情. 提交于 2020-01-05 04:16:18
问题 Hi all i am having two check box controls in my gridview what i need is if i checked a check box the other should be get enabled and if i uncheck it should get disable is there any way to do it. I write this but i am not getting the required one <script type="text/javascript"> function checkboxClick(checked, boxId) { var childCheckbox = document.getElementById(boxId); childCheckbox.disabled = !checked; if(childCheckbox.disabled) //uncheck when disabled childCheckbox.checked = false; } <