gridview

Grid of images inside ScrollView

那年仲夏 提交于 2019-12-17 01:36:28
问题 I'm trying to create a screen with both text and images. I want the images to be laid out like a grid, as shown below, but I want them to have no scroll functionality other that the one provided by the surrounding ScrollView. An image will best illustrate my question: <ScrollView> <LinearLayout> <ImageView /> <TextView /> <GridView /> <TextView /> </LinearLayout> </ScrollView> What is the best way to make show a grid of a varying number of images, where the grid does not have scroll

GridView编辑删除操作

耗尽温柔 提交于 2019-12-16 19:40:09
第一种:使用DataSource数据源中自带的编辑删除方法,这样的不经常使用,在这里就不加说明了。 另外一种:使用GridView的三种事件:GridView1_RowEditing(编辑)、GridView1_RowUpdating(更新)、GridView1_RowCancelingEdit(取消编辑)。 GridView1属性 中将DataKeyNames的值设置为主键名,否则找不到索引,这个非常重要哦。 该方法有2种操作,一种是不正确绑定列转换为模板列,第二种是转换为模板列。 这里先说不转换为模板列的情况; 首先;先对GridView进行数据绑定,无论用代码绑定还是DataSource绑定都能够。绑定好后,对GridView加入绑定列 和编辑列 (注意这里,加入好后不做不论什么修改, 千万不要将它们转换为模板列 ),加入好后,将所要绑定的数据库表字段填入 属性中。 然后,分别激活上述提到的三种事件,然后加入代码: protected void GridView1_RowDeleting (object sender, GridViewDeleteEventArgs e) { //运行删除 string str = "delete from tb_hby where id='"+GridView1.DataKeys[e.RowIndex].Value.ToString()+"

How to find label control in the RowCommand method of grid view?

夙愿已清 提交于 2019-12-14 04:00:04
问题 GridViewRow clickedRow = ((LinkButton)sender).NamingContainer as GridViewRow; Label lblUser = clickedRow.FindControl("lblFullName") as Label; Label lblUserId = (Label)clickedRow.FindControl("lblUserId"); Compiler throwing error as Unable to cast object of type 'System.Web.UI.WebControls.GridView' 回答1: The problem with your current code is that the GridView's RowCommand event is raised by gridview itself and not by an individual control thus your cast will fail:- (LinkButton)sender Because

How to create a gridview row clickable?

ε祈祈猫儿з 提交于 2019-12-14 03:59:20
问题 I want to create a gridview row where the whole row is clickable and when I click anywhere on the row it open another aspx page with the rows information. I am using asp.net and C#. Can anyone help me please. Thanks in advance. 回答1: Just call below code on RowDataBound to click anywhere on Gridview row to fire SelectedIndexChanged event You have to do <%@ Page EnableEventValidation="False" %> protected void grdYourGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType ==

Yii2: dynamic model attributes

自古美人都是妖i 提交于 2019-12-14 03:57:26
问题 I have table Lang: id | lang_name Table2: Messages: id | message_code Table3: Dictionary id | message_id | lang_id | translation I want to bring to the gridview with languages. Format: message_code | en_translation | ..._translation |..._translation As the number of languages is not known, i pass value of columns in array to gridview. There is one problem: I need to pass the value of the language id to relation model. I do not know how. $searchModel = new langmessages_search(); $dataProvider

How to stop GridView from loading again when I press back button?

℡╲_俬逩灬. 提交于 2019-12-14 03:54:45
问题 I created an Android application with Two Fragment, MainFragment --> WebviewFragment . The MainFragment is GridView which fetch the Grid Item from Json link. When I navigate back from WebviewFragment to MainFragment by pressing the back button, the Gridview fetches the data again. Is there any solution for this? MainFragment public class MainFragment extends Fragment { // Log tag private static final String TAG = MainActivity.class.getSimpleName(); // Movies json url private static final

How do I add rounded corners to a GridView table in my .net code?

人走茶凉 提交于 2019-12-14 03:51:02
问题 I've tried adding webkit border radius / moz border radius / border radius to both the css definition and the .net definition, but to no avail. Help! <tr> <td width="60%" align="center"> <asp:GridView ID="GridView_VE" runat="server" CssClass="table1" HorizontalAlign="Center" Width="80%" OnPageIndexChanging="GridView_VE_PageIndexChanging" Font-Names="Century Gothic" Font-Size="Large" Height="100%" AllowPaging="True" PageSize="4" RowStyle-Height="30px" -webkit-border-radius= "10px" -moz-border

How do I calculate the required height of a GridView that is inside of a ScrollView on Android?

烈酒焚心 提交于 2019-12-14 03:47:14
问题 I have a GridView inside of a LinearLayout inside of a ScrollView that pages in data from the server. Beneath the GridView is a button to load more data. My GridView will have an ultimate height that is larger than the screen. If I set the height of my GridView to either wrap_content or parent_fill, it sizes itself to the exact available on-screen height and does not scroll at all, cropping out the extra rows. If I explicitly set the layout_height to something large, like 1000dip, scrolling

Click anywhere on a GridView row to enter the edit mode

微笑、不失礼 提交于 2019-12-14 03:42:37
问题 I want to duplicate the same functionality of the edit button using a single click anywhere in a GridView row. The code below does this, but with a major problem: if the user clicks off of one textbox to the next, the edit command fires again , and the changes made to the previous textbox revert back to it's original value. Any suggestions on how to fix this behaviour? Or, is there a better approach to accomplishing this? EDIT: This was resolved by adding a check for row.RowState.HasFlag(

Ambiguous column name 'ProductID' in asp.net

a 夏天 提交于 2019-12-14 03:35:31
问题 I have this in my html: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowCommand = "GridView1_RowCommand" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID" /> <asp:BoundField DataField="ProductID" HeaderText="ProductID" SortExpression="ProductID" /> <asp:BoundField DataField="TotalProduct" HeaderText="TotalProduct" SortExpression="TotalProduct" /> <asp:BoundField DataField=