gridview

How can I display two query result in a single gridview?

社会主义新天地 提交于 2019-12-25 01:47:07
问题 I am trying to display two query result in a single gridview. I surfed a lot in internet but I did not get a proper answer. Kindly help anyone. My sample query int shift=0; int month = Convert.ToInt32( ddmonth.SelectedItem.Value);// should be in the format of Jan, Feb, Mar, Apr, etc... int yearofMonth = Convert.ToInt32(ddyear.Text); DateTime dateTime = Convert.ToDateTime(month + "-" + "01-" + yearofMonth); string month1 = dateTime.Month.ToString(); int year = Convert.ToInt32(ddyear.Text);

Sort columns based on gridview double header

会有一股神秘感。 提交于 2019-12-25 01:43:51
问题 I have a requirment where in i need to sort the columns of my gridview. But the catch is that i need to place an additional row below my gridview columns which would have ascending and descending sort images. When clicking on this images, sorting of the selected column should take place. Please guide me!! Let me know if you have any query/doubts Thanks! 回答1: My decision: <asp:GridView runat="server" ID="GridViewTest" DataSourceID="CustomersSource" AutoGenerateColumns="false"> <Columns> <asp

Checkbox in gridview

99封情书 提交于 2019-12-25 01:39:33
问题 As I have check box in gridview if i dont select any one checkbox and if i click asp button then i have to show message to user to select checkbox awaiting response 回答1: Should be something like you need... Boolean Selected = false; for (int count = 0; count < grd.Rows.Count; count++) { if (((CheckBox)grd.Rows[count].FindControl("yourCheckbox")).Checked) { Selected = true; } } if (Selected == false) { //your message goes here. } if you need javascript code... function CheckIfSelect() { var

list.js sorting not working

南楼画角 提交于 2019-12-25 01:15:38
问题 I am trying to sort (name, title, label, view) data using list.js. I have installed list.js using bower and mentioned the source in the html template <script src="/static/vendors/list.js/dist/list.min.js"></script>. I am exactly trying to replicate this codepen but with angular. Note: I am aware about angular sorting! Problem: Sorting and view change doesn't seems to work <div id="artists"> <input class="search" placeholder="Search" /> <button class="sort" data-sort="artist-name">Sort by name

How can I refresh only a GridView in a parent window with JavaScript?

孤街浪徒 提交于 2019-12-25 01:15:28
问题 I have two aspx files for adding/deleting products to/from a sale. islemler.aspx SatisTedarik.aspx I have a GridView in islemler.aspx, this gridView's name is islemlerGridView when a line is selected on islemlerGridView a button appears, and name of this button is islemDetayGorButton . When islemDetayGorButton is clicked SatisTedarik.aspx is opened. On SatisTedarik.aspx there are many elements such as labels, textboxes, dropdownlists, gridviews and via this SatisTedarik.aspx window user can

string.replace databound column in Gridview

假如想象 提交于 2019-12-25 00:56:05
问题 Im currently pulling a string comment from a DB into a gridview to display to the user. Throughout the string i have placed <br/> s where i want linebreaks, but am wondering how to replace the <br/> s with "Environment.Newline"s. the column is simply a boundfield. <Columns> <asp:BoundField HeaderText="Comment" DataField="UAComment" /> </Columns> and im populating the table with an adapter and Fill(): adapter = new SqlDataAdapter(queryString, connection); connection.Open(); adapter

BindData to ITemplate for GridView in code behind

旧巷老猫 提交于 2019-12-25 00:38:07
问题 How do I programmatically bind data to a custom item template column for a GridView? So far, I've done something similar to this: TemplateField foo = new TemplateField(); foo.ItemTemplate = new bar(); this.GridView1.Columns.Add(foo); where bar is like this: public class bar : ITemplate { public bar() { } public void InstantiateIn(Control container) { DropDownList ddl = new DropDownList(); container.Controls.Add(ddl); } } (the actual dropdownlist is populated) But ITemplate doesn't contain any

How can I bind a query with a join to a GridView, with a Linq datasource with a business layer and data access layer

偶尔善良 提交于 2019-12-25 00:32:54
问题 I have two tables that I'd like to join together display in a GridView foo fooID fooName barID 1 Alice 2 2 Bob 1 3 Charlie 1 bar barID barTitle 1 Developer 2 Project Manager (relationships and constraints have been defined in the database) I've got a GridView for foo that outputs like this Name Title Alice 2 Bob 1 Charlie 1 But I'd like see the following Name Title Alice Project Manager Bob Developer Charlie Developer Clearly, my SQL would look like: select fooName as Name, barTitle as Title

Gridview doesnt update after the delete command

陌路散爱 提交于 2019-12-25 00:29:40
问题 Basically, I use objectdatasource with gridview.. Everything works, but the gridview, doesnt update as soon as I click the delete button. This forces me to use Server.Transfer on the gridviews events: protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e) { //Server.Transfer(~/SamePageAsTheGridview); } Is there a way for the data to be updated without full post back? 回答1: After deleting the selected item from your objectsource, Just rebind the data to the gridview

ASP.net GridView: hide Edit|Delete links

老子叫甜甜 提交于 2019-12-25 00:14:09
问题 I have GridView with AutoGenerateDeleteButton=true && AutoGenerateEditButton=true . I want to allow only registered users to use these functions therefore I want to hide it from unregistered users. How can I hide it? I tried hidding the whole column but on page_load gridView is not ready yet so I get null exception. 回答1: On your pageLoad event store user Role inside Session protected void Page_Load(object sender, EventArgs e) { Session["usrRole"] = "1"; } On Row databound event of your