Search Results

Search found 1260 results on 51 pages for 'gridview'.

Page 14/51 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • GridView's NewValues and OldValues empty in the OnRowUpdating event.

    - by Abe Miessler
    I have the GridView below. I am binding to a custom datasource in the code behind. It gets into the "OnRowUpdating" event just fine, but there are no NewValues or OldValues. Any suggestions as to how I can get these values? <asp:GridView ID="gv_Personnel" runat="server" OnRowDataBound="gv_Personnel_DataBind" OnRowCancelingEdit="gv_Personnel_CancelEdit" OnRowEditing="gv_Personnel_EditRow" OnRowUpdating="gv_Personnel_UpdateRow" AutoGenerateColumns="false" ShowFooter="true" DataKeyNames="BudgetLineID" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" > <Columns> <asp:BoundField HeaderText="Level of Staff" DataField="LineDescription" /> <%--<asp:BoundField HeaderText="Hrs/Units requested" DataField="NumberOfUnits" />--%> <asp:TemplateField HeaderText="Hrs/Units requested"> <ItemTemplate> <%# Eval("NumberOfUnits")%> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="tb_NumUnits" runat="server" Text='<%# Bind("NumberOfUnits")%>' /> </EditItemTemplate> </asp:TemplateField> <asp:BoundField HeaderText="Hrs/Units of Applicant Cost Share" DataField="" NullDisplayText="0" /> <asp:BoundField HeaderText="Hrs/Units of Partner Cost Share" DataField="" NullDisplayText="0" /> <asp:BoundField FooterStyle-Font-Bold="true" FooterText="TOTAL PERSONNEL SERVICES:" HeaderText="Rate" DataFormatString="{0:C}" DataField="UnitPrice" /> <asp:TemplateField HeaderText="Amount Requested" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true"/> <asp:TemplateField HeaderText="Applicant Cost Share" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true"/> <asp:TemplateField HeaderText="Partner Cost Share" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true"/> <asp:TemplateField HeaderText="Total Projet Cost" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true"/> </Columns> </asp:GridView>

    Read the article

  • Gridview Paging via ObjectDataSource: Why is maximumRows being set to -1?

    - by Bryan
    So before I tried custom gridview paging via ObjectDataSource... I think I read every tutorial known to man just to be sure I got it. It didn't look like rocket science. I've set the AllowPaging = True on my gridview. I've specified PageSize="10" on my gridview. I've set EnablePaging="True" on the ObjectDataSource. I've added the 2 paging parms (maximumRows & startRowIndex) to my business object's select method. I've created an analogous "count" method with the same signature as the select method. The only problem I seem to have is during execution... the ObjectDataSource is supplying my business object with a maximumRows value of -1 and I can't for the life of me figure out why. I've searched to the end of the web for anyone else having this problem and apparently I'm the only one. The StartRowIndex parameter seems to be working just fine. Any ideas?

    Read the article

  • C# DotNetNuke Module: GridVIew AutoGenerateEditButton is skipping over a field on update.

    - by AlexMax
    I have a GridView with an automatically generated Edit button. I wanted some customized behavior for the Image column, since I wanted it to be a drop down list of items as opposed to a simple input field, and I also wanted some nice "fallback" in case the value in the database didn't actually exist in the drop down list. With the code I have done so far, I have gotten the behavior I desire out of the Image field. The problem is that when i attempt to update that particular field, I get an error spit out back at me that it can't find a method to update the form with: ObjectDataSource 'objDataSource' could not find a non-generic method 'UpdateDiscovery' that has parameters: ModuleId, Visible, Position, Title, Link, ItemId. That's not good, because I DO have an UpdateDiscovery method. However, between Title and Link, there is supposed to be another param that belongs to the Image field, and it's not being passed. I realize that it's probably the update button doesn't know to pass that field, since it's a TemplateField and not a BoundField, and when I use Bind('image') as the selected value for the drop down list, it seems to update fine...but only as long as the field in the database when I try and edit the row actually exists, otherwise it bombs out and gives me an error about the value not existing in the drop down list. I have the following GridView defined: <asp:GridView ID="grdDiscoverys" runat="server" DataSourceID="objDataSource" EnableModelValidation="True" AutoGenerateColumns="false" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" DataKeyNames="ItemId" OnRowDataBound="cmdDiscovery_RowDataBound"> <Columns> <asp:BoundField DataField="ItemId" HeaderText="#" ReadOnly="true" /> <asp:BoundField DataField="Visible" HeaderText="Visible" /> <asp:BoundField DataField="Position" HeaderText="Position" /> <asp:TemplateField HeaderText="Image"> <ItemTemplate> <asp:Label ID="lblViewImage" runat="server" /> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="ddlEditImage" runat="server" title="Image" DataValueField="Key" DataTextField="Value" /> </EditItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Title" HeaderText="Title" /> <asp:BoundField DataField="Link" HeaderText="Link" /> </Columns> </asp:GridView> The datasource that this is tied to: <asp:ObjectDataSource ID="objDataSource" runat="server" TypeName="MyCompany.Modules.Discovery.DiscoveryController" SelectMethod="GetDiscoverys" UpdateMethod="UpdateDiscovery" DeleteMethod="DeleteDiscovery"> <SelectParameters> <asp:QueryStringParameter Name="ModuleId" QueryStringField="mid" /> </SelectParameters> <UpdateParameters> <asp:QueryStringParameter Name="ModuleId" QueryStringField="mid" /> </UpdateParameters> <DeleteParameters> <asp:QueryStringParameter Name="ModuleId" QueryStringField="mid" /> </DeleteParameters> </asp:ObjectDataSource> The cmdDiscovery_RowDataBound method that gets called when the row's data is bound is the following C# code: protected void cmdDiscovery_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowIndex >= 0) { int intImage = ((DiscoveryInfo)e.Row.DataItem).Image; if (grdDiscoverys.EditIndex == -1) { // View Label lblViewImage = ((Label)e.Row.FindControl("lblViewImage")); if (GetFileDictionary().ContainsKey(intImage)) { lblViewImage.Text = GetFileDictionary()[intImage]; } else { lblViewImage.Text = "Missing Image"; } } else { // Edit DropDownList ddlEditImage = ((DropDownList)e.Row.FindControl("ddlEditImage")); ddlEditImage.DataSource = GetFileDictionary(); ddlEditImage.DataBind(); if (GetFileDictionary().ContainsKey(intImage)) { ddlEditImage.SelectedValue = intImage.ToString(); } } } } catch (Exception exc) { //Module failed to load Exceptions.ProcessModuleLoadException(this, exc); } } How do I make sure that the Image value in the drop down list is passed to the update function?

    Read the article

  • FAQ: GridView Calculation with JavaScript - Formatting and Validation

    - by Vincent Maverick Durano
    In my previous post here we've talked about how to calculate the sub-totals and grand total in GridView using JavaScript. In this post I'm going take more step further and will demonstrate how are we going to format the totals into a currency and how to validate the input that would only allow you to enter a whole number in the quantity TextBox. Here are the code blocks below: ASPX Source:   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> <script type="text/javascript"> function CalculateTotals() { var gv = document.getElementById("<%= GridView1.ClientID %>"); var tb = gv.getElementsByTagName("input"); var lb = gv.getElementsByTagName("span"); var sub = 0; var total = 0; var indexQ = 1; var indexP = 0; var price = 0; for (var i = 0; i < tb.length; i++) { if (tb[i].type == "text") { ValidateNumber(tb[i]); price = lb[indexP].innerHTML.replace("$", "").replace(",", ""); sub = parseFloat(price) * parseFloat(tb[i].value); if (isNaN(sub)) { lb[i + indexQ].innerHTML = "0.00"; sub = 0; } else { lb[i + indexQ].innerHTML = FormatToMoney(sub, "$", ",", "."); ; } indexQ++; indexP = indexP + 2; total += parseFloat(sub); } } lb[lb.length - 1].innerHTML = FormatToMoney(total, "$", ",", "."); } function ValidateNumber(o) { if (o.value.length > 0) { o.value = o.value.replace(/[^\d]+/g, ''); //Allow only whole numbers } } function isThousands(position) { if (Math.floor(position / 3) * 3 == position) return true; return false; }; function FormatToMoney(theNumber, theCurrency, theThousands, theDecimal) { var theDecimalDigits = Math.round((theNumber * 100) - (Math.floor(theNumber) * 100)); theDecimalDigits = "" + (theDecimalDigits + "0").substring(0, 2); theNumber = "" + Math.floor(theNumber); var theOutput = theCurrency; for (x = 0; x < theNumber.length; x++) { theOutput += theNumber.substring(x, x + 1); if (isThousands(theNumber.length - x - 1) && (theNumber.length - x - 1 != 0)) { theOutput += theThousands; }; }; theOutput += theDecimal + theDecimalDigits; return theOutput; } </script> </head> <body> <form id="form1" runat="server"> <asp:gridview ID="GridView1" runat="server" ShowFooter="true" AutoGenerateColumns="false"> <Columns> <asp:BoundField DataField="RowNumber" HeaderText="Row Number" /> <asp:BoundField DataField="Description" HeaderText="Item Description" /> <asp:TemplateField HeaderText="Item Price"> <ItemTemplate> <asp:Label ID="LBLPrice" runat="server" Text='<%# Eval("Price","{0:C}") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Quantity"> <ItemTemplate> <asp:TextBox ID="TXTQty" runat="server" onkeyup="CalculateTotals();"></asp:TextBox> </ItemTemplate> <FooterTemplate> <b>Total Amount:</b> </FooterTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Sub-Total"> <ItemTemplate> <asp:Label ID="LBLSubTotal" runat="server" ForeColor="Green" Text="0.00"></asp:Label> </ItemTemplate> <FooterTemplate> <asp:Label ID="LBLTotal" runat="server" ForeColor="Green" Font-Bold="true" Text="0.00"></asp:Label> </FooterTemplate> </asp:TemplateField> </Columns> </asp:gridview> </form> </body> </html> Code Behind Source:   public partial class GridCalculation : System.Web.UI.Page { private void BindDummyDataToGrid() { DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("RowNumber", typeof(string))); dt.Columns.Add(new DataColumn("Description", typeof(string))); dt.Columns.Add(new DataColumn("Price", typeof(decimal))); dr = dt.NewRow(); dr["RowNumber"] = 1; dr["Description"] = "Nike"; dr["Price"] = "1000"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["RowNumber"] = 2; dr["Description"] = "Converse"; dr["Price"] = "800"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["RowNumber"] = 3; dr["Description"] = "Adidas"; dr["Price"] = "500"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["RowNumber"] = 4; dr["Description"] = "Reebok"; dr["Price"] = "750"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["RowNumber"] = 5; dr["Description"] = "Vans"; dr["Price"] = "1100"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["RowNumber"] = 6; dr["Description"] = "Fila"; dr["Price"] = "200"; dt.Rows.Add(dr); //Bind the Gridview GridView1.DataSource = dt; GridView1.DataBind(); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindDummyDataToGrid(); } } } Running the code above will display something like this: On initial load After entering the quantity in the TextBox That's it! I hope someone find this post useful! Technorati Tags: ASP.NET,C#,ADO.NET,JavaScript,GridView

    Read the article

  • ASP.NET - Extend gridview to allow filtering, sorting, paging, etc...

    - by Zach
    I have seen threads on many sites regarding extending the gridview control so obviously this will be a duplicate. But I haven't found any that truly extend the control to the extent that you could have custom sorting (with header images), filtering by putting drop downs or textboxes in header columns (on a column by column basis) and custom paging (one that doesn't return all records but just returns the ones requested for the given page). Are there any good tutorials that show the inner-workings of the gridview and how to override the proper functions? I've seen several snippets here and there but none seem to really work and explain things well. Any links would be appreciated. Thanks!

    Read the article

  • Possible to Freeze Columns in a WPF ListView/GridView?

    - by Phil Sandler
    I currently have a GridView inside a ListView.View. The GridView columns will far exceed the width of the screen, so there will always be horizontal scrolling. What I would like to do is to have certain columns always remain on the screen regardless of scrolling. So the first x columns from the left are frozen (ala Excel), and the rest can scroll. It does not need to be dynamic/user selected--I know in advance which columns need to be frozen. Is this possible?

    Read the article

  • Plz Help! How to maintain status of gridview checkbox

    - by Royson
    Hi, On my form on left side i have tree-view with check-boxes and on right side grid-view with check-box column. Treeview shows all folders. if user clicked on treenode their files all displayed in gridview. If user checked some files and selects another node and return back it should display checked files as it is. How do i maintain grid-view checked-box column status..? One more query If i checked specific node it should checked all rows of a gridview.

    Read the article

  • Displaying list of objects as single column in a bound gridview (Winforms)?

    - by Carrie Nelson
    I have a gridview that is bound to a datasource on a Windows Form (VB.NET). The grid displays a list of "certifications", and each "certification" can be associated with many languages. So in the grid, I'd like to display "languages" as a column, and display a comma delimited list of the language names for each "certification". In the "certification" class, one of the properties is a list of "language" objects, and each "language" has an ID (guid), name (string), and value (integer). So in the datasource, I have the list of "languages", but I can't figure out how to display them in a column on the grid. The gridview won't let me add the language list property as a column. So is the ONLY way to add a new property on the "certification" class, which returns a string that contains the comma delimited list, and show THAT on the grid? Or is there a way to display that list of "languages"?

    Read the article

  • How to bind a label inside a gridview to another table?

    - by Kolten
    I have a very standard Gridview, with Edit and Delete buttons auto-generated. It is bound to a tableadapter which is linked to my "RelationshipTypes" table. dbo.RelationshipTypes: ID, Name, OriginConfigTypeID, DestinationConfigTypeID I wish to use a label that will pull the name from the ConfigTypes table, using the "OriginConfigTypeID" and "DestinationTypeID" as the link. dbo.ConfigTypes: ID, Name My problem is, I can't automatically generate Edit and Delete buttons using an Inner Join in my dataset. Or can I? FOllowing is my code: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" CssClass="TableList" DataKeyNames="ID" DataSourceID="dsRelationShipTypes1"> <Columns> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" Visible=False/> <asp:TemplateField HeaderText="Origin" SortExpression="OriginCIType_ID"> <EditItemTemplate> &nbsp;<asp:DropDownList Enabled=true ID="DropDownList2" runat="server" DataSourceID="dsCIType1" DataTextField="Name" DataValueField="ID" SelectedValue='<%# Bind("OriginCIType_ID") %>'> </asp:DropDownList> </EditItemTemplate> <ItemTemplate> &nbsp; <asp:Label ID="Label2" runat="server" Text='<%# Bind("OriginCIType_ID") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Name" SortExpression="Name"> <EditItemTemplate> <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label3" runat="server" Text='<%# Bind("Name") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Destination" SortExpression="DestinationCIType_ID"> <EditItemTemplate> <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="dsCIType1" DataTextField="Name" DataValueField="ID" SelectedValue='<%# Bind("DestinationCIType_ID") %>'> </asp:DropDownList> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("DestinationCIType_ID") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> So I did try to create my own edit and delete buttons, but kept receiving the error "cannot find update method" or something similar. Do I have to manually code the delete and update methods in my code-behind?

    Read the article

  • Find CheckBox from GridView in Content Page/Master Page

    - by Suthish Nair
    How to find a control from GridView which resides in Content Page Here the example using to find the CheckBox, hope this will help you all... .aspx code <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"> <asp:GridView ID="GridView1" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="chkID" runat="server" /> </ItemTemplate> </asp...(read more)

    Read the article

  • FAQ: GridView Calculation with JavaScript - Displaying Quantity Total

    - by Vincent Maverick Durano
    Previously we've talked about how calculate the sub-totals and grand total in GridView here, how to format the numbers into a currency format and how to validate the quantity to just accept whole numbers using JavaScript here. One of the users in the forum (http://forums.asp.net) is asking if how to modify the script to display the quantity total in the footer. In this post I'm going to show you how to it. Basically we just need to modify the javascript CalculateTotals function and add the codes there for calculating the quantity total and display it in the footer. Here are the code blocks below:   <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> <script type="text/javascript"> function CalculateTotals() { var gv = document.getElementById("<%= GridView1.ClientID %>"); var tb = gv.getElementsByTagName("input"); var lb = gv.getElementsByTagName("span"); var sub = 0; var total = 0; var indexQ = 1; var indexP = 0; var price = 0; var qty = 0; var totalQty = 0; for (var i = 0; i < tb.length; i++) { if (tb[i].type == "text") { ValidateNumber(tb[i]); price = lb[indexP].innerHTML.replace("$", "").replace(",", ""); sub = parseFloat(price) * parseFloat(tb[i].value); if (isNaN(sub)) { lb[i + indexQ].innerHTML = "0.00"; sub = 0; } else { lb[i + indexQ].innerHTML = FormatToMoney(sub, "$", ",", "."); ; } indexQ++; indexP = indexP + 2; if (isNaN(tb[i].value) || tb[i].value == "") { qty = 0; } else { qty = tb[i].value; } totalQty += parseInt(qty); total += parseFloat(sub); } } lb[lb.length - 2].innerHTML = totalQty; lb[lb.length - 1].innerHTML = FormatToMoney(total, "$", ",", "."); } function ValidateNumber(o) { if (o.value.length > 0) { o.value = o.value.replace(/[^\d]+/g, ''); //Allow only whole numbers } } function isThousands(position) { if (Math.floor(position / 3) * 3 == position) return true; return false; }; function FormatToMoney(theNumber, theCurrency, theThousands, theDecimal) { var theDecimalDigits = Math.round((theNumber * 100) - (Math.floor(theNumber) * 100)); theDecimalDigits = "" + (theDecimalDigits + "0").substring(0, 2); theNumber = "" + Math.floor(theNumber); var theOutput = theCurrency; for (x = 0; x < theNumber.length; x++) { theOutput += theNumber.substring(x, x + 1); if (isThousands(theNumber.length - x - 1) && (theNumber.length - x - 1 != 0)) { theOutput += theThousands; }; }; theOutput += theDecimal + theDecimalDigits; return theOutput; } </script> </head> <body> <form id="form1" runat="server"> <asp:gridview ID="GridView1" runat="server" ShowFooter="true" AutoGenerateColumns="false"> <Columns> <asp:BoundField DataField="RowNumber" HeaderText="Row Number" /> <asp:BoundField DataField="Description" HeaderText="Item Description" /> <asp:TemplateField HeaderText="Item Price"> <ItemTemplate> <asp:Label ID="LBLPrice" runat="server" Text='<%# Eval("Price","{0:C}") %>'></asp:Label> </ItemTemplate> <FooterTemplate> <b>Total Qty:</b> </FooterTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Quantity"> <ItemTemplate> <asp:TextBox ID="TXTQty" runat="server" onkeyup="CalculateTotals();"></asp:TextBox> </ItemTemplate> <FooterTemplate> <asp:Label ID="LBLQtyTotal" runat="server" Font-Bold="true" ForeColor="Blue" Text="0" ></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>Total Amount:</b> </FooterTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Sub-Total"> <ItemTemplate> <asp:Label ID="LBLSubTotal" runat="server" ForeColor="Green" Text="0.00"></asp:Label> </ItemTemplate> <FooterTemplate> <asp:Label ID="LBLTotal" runat="server" ForeColor="Green" Font-Bold="true" Text="0.00"></asp:Label> </FooterTemplate> </asp:TemplateField> </Columns> </asp:gridview> </form> </body> </html>   Here's the output below when you run it on the page: I hope someone find this post useful! Technorati Tags: ASP.NET,C#,JavaScript,GridView

    Read the article

  • A Look at the GridView&apos;s New Sorting Styles in ASP.NET 4.0

    Like every Web control in the ASP.NET toolbox, the GridView includes a variety of style-related properties, including <code>CssClass</code>, <code>Font</code>, <code>ForeColor</code>, <code>BackColor</code>, <code>Width</code>, <code>Height</code>, and so on. The GridView also includes style properties that apply to certain classes of rows in the grid, such as <code>RowStyle</code>, <code>AlternatingRowStyle</code>, <code>HeaderStyle</code>, and <code>PagerStyle</code>. Each of these meta-style properties offer the standard style properties (<code>CssClass</code>, <code>Font</code>, etc.) as subproperties.In ASP.NET 4.0, Microsoft added four new

    Read the article

  • Android GridView Custom BaseAdapter ImageView ImageButton OnItemClick doesn´t work

    - by Marek
    i have a problem using a GridView with a CustomAdapter (extends BaseAdapter). any Activity implements the OnItemClickListener. if i use ImageView as item everything works fine, OnItemClick-Events will be fired/catched I have not found a useful example for a GridView with a custom BaseAdapter using ImageButton. Has anyone an idea? Many thanks in advantage! Snippets: class MyActivity extends Activity implements OnItemClickListener { ... @Override public void onCreate() { ... GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setOnItemClickListener(this); gridview.setAdapter(new ImageButtonAdapter(this)); } ... @Override public void onItemClick(AdapterView<?> adapter, View view, int arg2, long arg3) { Log.e("onItemClick()", "arg2=" + arg2 + ", arg3=" + arg3); } } public class ImageButtonAdapter extends BaseAdapter { private Context mContext; public LayoutMenuAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } public View getView(int position, View convertView, ViewGroup parent) { /* IF I USE THIS PART EVERYTHING WORKS FINE */ // ImageView imageView; // if (convertView == null) { // imageView = new ImageView(mContext); // imageView.setLayoutParams(new GridView.LayoutParams(100, 100)); // imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); // imageView.setPadding(0, 0, 0, 0); // imageView.setFocusable(false); // } else { // imageView = (ImageView) convertView; // } // imageView.setImageResource(mThumbIds[position]); // return imageView; /* IF I USE THIS PART NO THE ACTIVITY/LISTENER RECEIVES NO EVENT */ ImageButton imageButton; if (convertView == null) { imageButton = new ImageButton(mContext); imageButton.setLayoutParams(new GridView.LayoutParams(100, 100)); imageButton.setScaleType(ImageView.ScaleType.CENTER_CROP); imageButton.setPadding(0, 0, 0, 0); imageButton.setFocusable(false); } else { imageButton = (ImageButton) convertView; } imageButton.setImageResource(mThumbIds[position]); return imageButton; } // references to images private Integer[] mThumbIds = { R.drawable.media}; }

    Read the article

  • Create an Asp.net Gridview with Checkbox in each row

    - by ybbest
    One of the frequent requirements for Asp.net Gridview is to add a checkbox for each row and a checkbox to select all the items like the Gridview below. This can be easily achieved by using jQuery. You can find the complete source doe here. $(document).ready(function () { $(‘input[name$="CDSelectAll"]‘).click(function () { if ($(this).attr(“checked”)) { $(‘input[name$="CDSelect"]‘).attr(‘checked’, ‘checked’); } else { $(‘input[name$="CDSelect"]‘).removeAttr(‘checked’); } }); });

    Read the article

  • How to select and deselect checkbox field into the GridView

    - by SAMIR BHOGAYTA
    //JavaScript function for Select and Deselect checkbox field in GridView function SelectDeselectAll(chkAll) { var a = document.forms[0]; var i=0; for(i=0;i lessthansign a.length;i++) { if(a[i].name.indexOf("chkItem") != -1) { a[i].checked = chkAll.checked; } } } function DeselectChkAll(chk) { var c=0; var d=1; var a = document.forms[0]; //alert(a.length); if(chk.checked == false) { document.getElementById("chkAll").checked = chk.checked; } else { for(i=0;i lessthansign a.length;i++) { if(a[i].name.indexOf("chkItem") != -1) { if(a[i].checked==true) { c=1; } else { d=0; } } } if(d != 0) { document.getElementById("chkAll").checked =true; } } } //How to use this function asp:TemplateField input id="Checkbox1" runat="server" onclick="javascript:SelectDeselectAll(this);" type="checkbox" / /HeaderTemplate /asp:GridView columns asp:TemplateFieldheadertemplate input id="chkAll" runat="server" onclick="javascript:SelectDeselectAll(this);" type="checkbox" / /HeaderTemplate

    Read the article

  • ASP.NET 3.5 Gridview Hyperlink Columns

    One of the most common applications of GridView tables in ASP.NET 3.5 involves hyperlinks. The hyperlink can be database-driven which means it will retrieve hyperlink information from the MS SQL server database in the form of URLs or part of complete URLs. Adding hyperlinks to the Gridview columns can be accomplished using the hyperlinkfield. ... Business Productivity Online Suite From $10 per user per month. Includes a 12-month subscription. Min 5 seats.

    Read the article

  • Mass Delete Using Gridview with Checkboxes

    This sample shows how to use a Gridview to delete multiple records all at once, having marked them with a Checkbox, and clicking one button, external to the Gridview, to delete them all As usual, here, we're using the Northwind Database. If you want to try this on your own Northwind database, adhere to this word of caution - "BACK IT UP FIRST". You will be making multiple deletes, so in order to get it back to the original state, you must make a backup and then restore afterwards. Remember too, that you will need to substitute your own Web.Config connectionstring entry for "YourNorthwindString" in the sample code

    Read the article

  • How to make a hyperlink through GridView column value?

    - by avirk
    I want here that user can see the answer under the question by selecting its heading. The question should be a hyperlink to redirect me on the page Answer.aspx. I mean to say that when user take cursor over the How to do this? it should redirect the user to the desired page. How can I do that? here is the code <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="100%" BorderStyle="None"> <Columns> <asp:BoundField DataField="QuestionHEAD" HeaderText="Question" SortExpression="QuestionHEAD" HeaderStyle-ForeColor="white" HeaderStyle-BackColor="Brown"/> <asp:BoundField DataField="Problem" HeaderText="Problem" SortExpression="Problem" HeaderStyle-ForeColor="white" HeaderStyle-BackColor="Brown" /> <asp:BoundField DataField="Forum" HeaderText="Forum" SortExpression="Forum" HeaderStyle-ForeColor="white" HeaderStyle-BackColor="Brown"/> <asp:BoundField DataField="Username" HeaderText="Asked By" SortExpression="Username" HeaderStyle-ForeColor="white" HeaderStyle-BackColor="Brown" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connectionstring %>" SelectCommand="SELECT [QuestionHEAD], [Problem], [Forum], [Username] FROM [Question]"> </asp:SqlDataSource>

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >