| |

VerySource

 Forgot password?
 Register
Search
View: 611|Reply: 5

2 questions for js and gridview

[Copy link]

2

Threads

10

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-2-9 13:30:01
| Show all posts |Read mode
1. I put a checkbox all-selected column in gridview, but after running, the column is not displayed
code show as below
<asp: GridView ID = "gvComUnion" runat = "server" AllowPaging = "True" AutoGenerateColumns = "False"
       BackColor = "White" BorderColor = "# 3366CC" BorderStyle = "Solid" BorderWidth = "1px"
       CellPadding = "4" Font-Size = "12px" HorizontalAlign = "Left" OnPageIndexChanging = "gvParty_PageIndexChanging"
       OnRowEditing = "gvParty_RowEditing" PageSize = "15" Width = "556px" OnRowDataBound = "gvParty_RowDataBound" OnLoad = "gvParty_Load" OnRowCreated = "gvParty_RowCreated" Font-Names = "宋体" OnSelectedIndexChanged = "gvComUnion_SelectedIndexd
       <PagerSettings FirstPageText = "FirstPage" LastPageText = "Last Page" Mode = "NextPreviousFirstLast"
         NextPageText = "Next Page" PreviousPageText = "Previous Page" />
       <FooterStyle BackColor = "#EFEFEF" ForeColor = "# 000D47" />
        <Columns>
        
            <asp: TemplateField>
                <HeaderTemplate>
                  <asp: CheckBox ID = "CheckBox1" runat = "server" Text = "Select All" AutoPostBack = "true" OnCheckedChanged = "CheckAll" />
                </ HeaderTemplate>
                <ItemTemplate>
                  <asp: CheckBox ID = "ItemCheckBox" runat = "server" />
                </ ItemTemplate>
              </ asp: TemplateField>



            <asp: BoundField DataField = "COMID" HeaderText = "Member ID" />
            <asp: BoundField DataField = "COMNAME" HeaderText = "unit name" />
            <asp: BoundField DataField = "COMINLOW" HeaderText = "ownership" />
            <asp: BoundField DataField = "BUSINESS" HeaderText = "Industry" />
            <asp: BoundField DataField = "DISTRICT" HeaderText = "located area" />
            <asp: BoundField DataField = "STATUS" HeaderText = "Status" />
            <asp: CommandField EditText = "Details" HeaderText = "Details" ShowEditButton = "True" />

        </ Columns>

        <RowStyle ForeColor = "# 003399" HorizontalAlign = "Center" />
        <SelectedRowStyle BackColor = "# 003399" Font-Bold = "True" ForeColor = "# CCFF99" />
        <PagerStyle BackColor = "# EFEFEF" ForeColor = "# 003399" HorizontalAlign = "Right" />
        <HeaderStyle BackColor = "# 003399" BorderStyle = "None" Font-Bold = "True" ForeColor = "White" />
        <AlternatingRowStyle BackColor = "# EFEFEF" />
        
    </ asp: GridView>


Question 2;
The reference code is as follows
<input id = "Text1" type = "text" onclick = "return showCalendar ('Text1', 'y-mm-dd');" onfocus = "return showCalendar ('Text1', 'y-mm-dd') ; "/> No line breaks here <img src =" ../ images / 1.gif "alt =" select date "width =" 25px "height =" 21px "style =" CURSOR: hand "onclick =" return showCalendar ('Text1', 'y-mm-dd'); "/>
Which cannot be newline, otherwise the operation is invalid, I do not know why
Reply

Use magic Report

0

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-2 20:15:01
| Show all posts
Give you a good one:

<asp: TemplateField>
                                <EditItemTemplate>
                                    <asp: CheckBox ID = "CheckBox1" runat = "server" />
                                </ EditItemTemplate>
                                <ItemTemplate>
                                    <asp: CheckBox ID = "chbitem" runat = "server" />
                                </ ItemTemplate>
                                <HeaderTemplate>
                                   <input id = "chkAll" onclick = "javascript: SelectAllCheckboxes (this);"
              runat = "server" type = "checkbox" />
                                </ HeaderTemplate>
                            </ asp: TemplateField>


function SelectAllCheckboxes (spanChk) {

   // Added as ASPX uses SPAN for checkbox
   var oItem = spanChk.children;
   var theBox = (spanChk.type == "checkbox")?
        spanChk: spanChk.children.item [0];
   xState = theBox.checked;
   elm = theBox.form.elements;

   for (i = 0; i <elm.length; i ++)
     if (elm [i] .type == "checkbox"&&
              elm [i] .id! = theBox.id)
     {
       // elm [i] .click ();
       if (elm [i] .checked! = xState)
         elm [i] .click ();
       //elm[i].checked=xState;
     }
 }
Reply

Use magic Report

0

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-2 20:45:02
| Show all posts
Just call it
Reply

Use magic Report

2

Threads

10

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-4-2 21:15:01
| Show all posts
Find the reason
Reply

Use magic Report

2

Threads

10

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-4-3 09:15:01
| Show all posts
Still can't show the select all column, isn't the property needed to be set
Reply

Use magic Report

2

Threads

10

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-4-5 20:30:01
| Show all posts
It seems that the first column of gridview is not displayed.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list