gridview

Dynamically change the class of a div nested in a gridview item template from code behind c# [closed]

只愿长相守 提交于 2019-12-31 07:43:07
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . I need to change the class of a div nested inside a gridview item template, i have given the runat="server" tag and an id for the div. How can we change the class of that particular div upon gridview databind based on each row conditions. 回答1: ASPX <asp:GridView ID="gv" runat="server"

Set gridview backcolor to color from datatable?

折月煮酒 提交于 2019-12-31 07:33:33
问题 I have a datatable that looks like this: Row1 Row2 Row3 Row4 Row5 Row6 Gold Gold Pink Pink #FB7703 #FB7703 Red Red Yellow Green #0B93E1 Purple This is what the grid looks like when When I bind the datatable to the grid: How can set background color of the cells in the gridview to the color in the cell? I know I need to use RowDataBound . Markup for gridview: <div> <asp:GridView ID="GridViewClicks" runat="server" onrowdatabound="GridViewClicks_RowDataBound"> </asp:GridView> </div> And

Incorrect syntax near 'nvarchar' must declare scalar variable near @num

二次信任 提交于 2019-12-31 05:37:08
问题 Hi all I created a project that has a Formview bound to a Gridview. All the other commands seem to work fine except when I try to update the form view I get the error in the title. Here is my code. <EditItemTemplate> num: <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("[num]") %>' /> <br /> Job Title: <asp:TextBox ID="Job_TitleTextBox" runat="server" Text='<%# Bind("[Job Title]") %>' /> <br /> Status: <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' /> <br

Show files from 2 different folders in a single Gridview

て烟熏妆下的殇ゞ 提交于 2019-12-31 05:25:13
问题 Is it possible to show files from 2 different folders (c:\test1 and c:\test2) in the same gridview? I work in VB.net (VS 2010) Thanks! 回答1: Yes. Get list of all the files using Directory.GetFiles() into a single IEnumerable<string> and bind it to a GridView. This is how you'll do it in c#. List<string> allFiles = new List<string>(); allFiles.AddRange(Directory.GetFiles(@"C:\test1\*")); allFiles.AddRange(Directory.GetFiles(@"C:\test2\*")); yourGV.DataSource = allFiles; yourGV.DataBind(); 回答2:

DevExpress GridControl Unbound Columns

断了今生、忘了曾经 提交于 2019-12-31 05:25:11
问题 I would like to know how to properly add a unbound column into a gridview. I've added a unbound column in the designer (set the unbound type, display format and all) but whenever I run the application, try to change the value of the unbound column and loses its focus the value is not saved (even the display format is not displaying correctly when I'm changing it). I must be doing something wrong. I need help guys! Much appreciated! 回答1: Unbound column does not provide a storage to save its

How do I format my export to excel workbook in microsoft.office.interop.excel?

感情迁移 提交于 2019-12-31 05:10:54
问题 I have this export function that allows me to export 2 grid views into 2 separated worksheets in one excel. But my problems are: How can I have a usual popup window like usual download when I click on export button to prompt user to OPEN, SAVE AS, CANCEL of the download instead of saving it to a specific location (currently what I am doing in my codes)? How can I set a code to enable wraptext = true for all my cells and also auto format the column height and width to fixed all the text so

How do I format my export to excel workbook in microsoft.office.interop.excel?

為{幸葍}努か 提交于 2019-12-31 05:10:14
问题 I have this export function that allows me to export 2 grid views into 2 separated worksheets in one excel. But my problems are: How can I have a usual popup window like usual download when I click on export button to prompt user to OPEN, SAVE AS, CANCEL of the download instead of saving it to a specific location (currently what I am doing in my codes)? How can I set a code to enable wraptext = true for all my cells and also auto format the column height and width to fixed all the text so

ASP.NET - Programmatic Edit

霸气de小男生 提交于 2019-12-31 05:07:29
问题 How can we programmatically take a GridView-row into Edit-mode using an Edit Command? Suppose I want to edit the name of the course 'C++'. How can I do that? Also see this 回答1: In the event handler: gridView.EditIndex = e.NewEditIndex; gridView.DataBind(); Is that what you're looking for? 来源: https://stackoverflow.com/questions/1301581/asp-net-programmatic-edit

how to add title for every header column in gridview in ASP.NET

梦想与她 提交于 2019-12-31 04:37:07
问题 i'm using ASP.NET , i have a gridview and i need to put a title in every header column , title will show on moseover ................................. do i have to convert the field to TemplateField some thing like this : <asp:BoundField DataField="ID_Dossier" HeaderText="ID_Dossier" ReadOnly="True" SortExpression="ID_Dossier" title="Trier par identifiant des dossiers " /> this is my gridbiew : <asp:GridView ID="DossierGV" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID=

ASP.NET 判断GRIDVIEW的checkbox是否选中

匆匆过客 提交于 2019-12-31 04:30:39
C# 实现 protected void btSubmit_Click(object sender, EventArgs e) { List<CheckBox> chkList = new List<CheckBox>(); foreach (GridViewRow row in this.GVReport.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox chk = row.FindControl("cbActionFlag") as CheckBox; if (chk.Checked) { chkList.Add(chk); } } } if (chkList.Count == 0) { ClientScript.RegisterStartupScript(typeof(string), "msgChk", "alert('please select active flag!');", true); } } Jquery 实现 <script type="text/jscript" language="javascript" src="<%=ResolveUrl("~/js/jquery-1.5.2.js") %>"></script> <script type="text/javascript"