Jump to content

kundan

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kundan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, i wanna freeze the grid view header fixed just like in excel as we scroll the rows scrolls away lea ving the column heading fixed I wanna perform this action using css in asp.net this is my code in asp.net <td style="padding-left: 5px" colspan="3"> <asp:Panel ID="pnlExclusionList" runat="server" Width="98%" Height="150px" ScrollBars="Vertical"> <asp:GridView runat="server" ID="gridXponentExclusionList" Width="100%" TabIndex="15" AutoGenerateColumns="False" Style="border-collapse: collapse;" OnRowDataBound="gridXponentExclusionList_RowDataBound"> <HeaderStyle CssClass="HeaderStyle" HorizontalAlign="Left"></HeaderStyle> <AlternatingRowStyle CssClass="AltRowStyle"></AlternatingRowStyle> <Columns> <asp:TemplateField HeaderText="Select"> <ItemStyle Width="12%"></ItemStyle> <HeaderStyle CssClass="clsLabel"></HeaderStyle> <ItemTemplate> <%--<asp:CheckBox ID="chkXponentExclusionList" runat="server" AutoPostback="true" OnCheckedChanged="chkXponentExclusionList_CheckedChanged"></asp:CheckBox>--%> <asp:CheckBox ID="chkXponentExclusionList" runat="server" AutoPostBack="false"></asp:CheckBox> <asp:Label ID="lblExclusionList" Visible="false" Text='<%# DataBinder.Eval (Container.DataItem, "XPON_EXCL_LIST_ID") %>' runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Label"> <ItemStyle Width="11%"></ItemStyle> <HeaderStyle CssClass="clsLabel"></HeaderStyle> <ItemTemplate> <asp:Label ID="XponentExclusionList" Visible="True" Text='<%# DataBinder.Eval (Container.DataItem, "XPON_LIST_VALUE") %>' runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Date Created"> <ItemStyle Width="20%"></ItemStyle> <HeaderStyle CssClass="clsLabel"></HeaderStyle> <ItemTemplate> <asp:Label ID="lblCreatedDate" Visible="true" Text='<%# Bind("CREATED_ON", "{0:MM/dd/yyyy}") %>' runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Physicians Count"> <ItemStyle Width="50%"></ItemStyle> <HeaderStyle CssClass="clsLabel"></HeaderStyle> <ItemTemplate> <asp:Label ID="lblNoOfPhysicians" Visible="true" Text='<%# DataBinder.Eval (Container.DataItem, "NO_OF_PHY") %>' runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField Visible="False" HeaderText="Description"> <ItemStyle Width="60%"></ItemStyle> <HeaderStyle CssClass="clsLabel"></HeaderStyle> <ItemTemplate> <asp:Label ID="lblExclusionValue" Visible="True" Text='<%# DataBinder.Eval (Container.DataItem, "XPON_LIST_VALUE") %>' runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> <RowStyle CssClass="RowStyle"></RowStyle> <PagerStyle CssClass="PagerStyle"></PagerStyle> </asp:GridView> </asp:Panel> </td> Thanks in advance :(kundan EDIT: OMG...this needs a dash of CODE TAGS
  2. hello, I have created an aplication using asp.net with C# and placed a grid by customizing and provided the headers and displayed the oracle'd data in it and provided the scroll bars but the problem when i scroll the grid the headers are also scrolled i want the header to be fixed and only the records sholud be scrolled.Please help me out on this regard. Thanks in Advance. Kundan
  3. the following are the pages where i perform the insert and delete operations this is insert page <html> <head></head> <body> <form id='f1' name='f1'> <?php include('display.php'); $disp=new Display(); $disp->disp(); ?> <script> //function for confirmation before updating the record function update(id) { var answer = confirm ("Are you sure you want to update the record?") if (answer) { window.location="empadd.php?empno="+id; return true; } else { return false; } } //function for confirmation before deleting the record function del(id) { var answer = confirm ("Are you sure you want to delete the record ?") if (answer) { window.location="empdelete.php?empno="+id; return true; } else { return false; } } //function for selecting/unselecting the checkboxes with header chcekbox... var checked=false; function checkedAll(frm1) { var aa= document.getElementById('f1'); if (checked == false) { checked = true; } else { checked = false } for (var i =0; i < aa.elements.length; i++) { aa.elements.checked = checked; } } //function for alerting the user when user tries to delete the record without selecting any checkbox var checked=false; function delall(frm1,id) { var aa= document.getElementById('f1'); alert(aa); for (var i =0; i < aa.elements.length; i++) { if(aa.elements=='checkbox') { alert('gdgkg'); } /*if(aa.elements.checked== false) { alert(aa.elements.id); alert('Please!Select Atleast One Check Box'); return false; }*/ /* var i=aa.elements.id; alert(document.getElementById(i)); break;*/ } } </script> </form> </body> </html> the display page: <?php class Display { function disp() { $mCon = mysql_connect("localhost","root"); if (!$mCon ) { die('Sorry!Not Connected To Database ' . mysql_error()); } mysql_select_db("KUNDAN", $mCon ); if(!isset($_REQUEST['btnUpdate'])) { $mSql="update emp set empno='$_POST[empno]',ename='$_POST[ename]',job='$_POST[job]',email='$_POST' where empno='$_POST[empno]'"; } else { $mSql="INSERT INTO emp VALUES ('$_POST[empno]','$_POST[ename]','$_POST[job]','$_POST')"; } if(!mysql_query($mSql,$mCon )) { die('Sorry!Please Check With Insert Query : ' . mysql_error()); } $mResult = mysql_query("SELECT * FROM emp"); echo "<table border='1' align='CENTER'> <tr> <th align='left'><input type='checkbox' name='checkall' onclick='return checkedAll(f1);'></th> <th><a href='empinsert.php?srt=empno'>Empno</a></th> <th><a href='empinsert.php?srt=ename'>Ename</a></th> <th><a href='empinsert.php?srt=job'>Job</a></th> <th><a href='empinsert.php?srt=email'>Email ID</a></th> <th>Edit</th> <th>Delete</th> </tr>"; echo "<tf>"; $mCon = mysql_connect("localhost","root"); if (!$mCon) { die('Sorry!Not Connected To Database ' . mysql_error()); } mysql_select_db("KUNDAN", $mCon); if (isset($_GET['pageno'])) { $mPageno = $_GET['pageno']; } else { $mPageno = 1; } // if $mQuery = "SELECT count(*) FROM emp"; $mResult= mysql_query($mQuery, $mCon) or die('Sorry!Not Connected To Database ' . mysql_error()); $mQueryData = mysql_fetch_row($mResult); $mNumrows = $mQueryData[0]; $rows_per_page = 3; $mLastpage = ceil($mNumrows /$rows_per_page); $mPageno = (int)$mPageno ; if ($mPageno > $mLastpage) { $mPageno = $mLastpage; } // if if ($mPageno < 1) { $mPageno = 1; } // if $mLimit = 'LIMIT ' .($mPageno - 1) * $rows_per_page .',' .$rows_per_page; $mQuery = "SELECT * FROM emp $mLimit"; if(isset($_REQUEST['srt'])) { $mId=$_REQUEST['srt']; $mQuery="select * from emp order by $mId $mLimit"; } $mResult = mysql_query($mQuery, $mCon) or die('Sorry!Not Connected To Database ' . mysql_error()); while($mRow = mysql_fetch_array($mResult)) { $mEmpno=$mRow['empno']; $mEname=$mRow['ename']; $mJob=$mRow['job']; $mEmail=$mRow['email']; echo "<tr>"; echo "<td><input type='checkbox' id='checkbox[]' name='checkbox[]' value='.$mRow[empno].' > </td>"; echo $mRow['empno']; echo "<td>" . $mRow['empno'] ."</td>"; echo "<td>" . $mRow['ename'] . "</td>"; echo "<td>" . $mRow['job'] . "</td>"; echo "<td>" . $mRow['email'] . "</td>"; echo "<td>" . "<input type='button' name='EDIT' value='EDIT' onclick='return update($mEmpno);'>" ."</td>"; echo "<td>" . "<input type='button' name='DELETE' value='DELETE' onclick='return del($mEmpno);')>" ."</td>"; echo "</tr>"; } echo "<tf>"; echo "<td>" . "<input type='button' name='DELETE ALL' value='DELETE ALL' onclick='return delall(f1,$mEmpno);')>" ."</td>"; echo "<td colspan='7' align='center'>"; if ($mPageno == 1) { echo " FIRST PREV "; } else { echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1'>FIRST</a> "; $mPrevPage = $mPageno -1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$mPrevPage'>PREV</a> "; } // if echo " ( Page $mPageno of $mLastpage ) "; if ($mPageno == $mLastpage) { echo " NEXT LAST "; } else { $mNextPage = $mPageno +1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$mNextPage'>NEXT</a> "; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$mLastpage'>LAST</a> "; } // if echo "</td>"; echo "</tf>"; echo "</table>"; mysql_close($mCon); } } ?> the delete page: <?php class Delete { function deleteRec() { $q=$_GET["empno"]; $con = mysql_connect('localhost', 'root'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("KUNDAN", $con); $sql="delete FROM emp WHERE empno = '".$q."'"; $result = mysql_query($sql); echo "<table border='1' align='CENTER'> <tr> <th align='left'><input type='checkbox' name='checkall' onclick='return checkedAll(f1);'></th> <th><a href='empinsert.php?srt=empno&spag=0'>Empno</a></th> <th><a href='empinsert.php?srt=ename&spag=0'>Ename</a></th> <th><a href='empinsert.php?srt=job&spag=0'>Job</a></th> <th><a href='empinsert.php?srt=email&spag=0'>Email ID</a></th> <th>Edit</th> <th>Delete</th> </tr>"; echo "<tf>"; $con = mysql_connect("localhost","root"); if (!$con) { die('Sorry!Not Connected To Database ' . mysql_error()); } mysql_select_db("KUNDAN", $con); if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } // if $query = "SELECT count(*) FROM emp"; $result = mysql_query($query, $con) or die('Sorry!Not Connected To Database ' . mysql_error()); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 3; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; if ($pageno > $lastpage) { $pageno = $lastpage; } // if if ($pageno < 1) { $pageno = 1; } // if $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $query = "SELECT * FROM emp $limit"; $result = mysql_query($query, $con) or die('Sorry!Not Connected To Database ' . mysql_error()); while($row = mysql_fetch_array($result)) { $empno=$row['empno']; $ename=$row['ename']; $job=$row['job']; $email=$row['email']; echo "<tr>"; echo "<td><input type='checkbox' name='checkbox[]' value='.$row[RowID].'> </td>"; echo "<td>" . $row['empno'] ."</td>"; echo "<td>" . $row['ename'] . "</td>"; echo "<td>" . $row['job'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . "<input type='button' name='EDIT' value='EDIT' onclick='return update($empno);'>" ."</td>"; echo "<td>" . "<input type='button' name='DELETE' value='DELETE' onclick='return del($empno);')>" ."</td>"; echo "</tr>"; } echo "<tf>"; echo "<td>" . "<input type='button' name='DELETE ALL' value='DELETE ALL' onclick='return delall(f1);')>" ."</td>"; echo "<td colspan='7' align='center'>"; if ($pageno == 1) { echo " FIRST PREV "; } else { echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1'>FIRST</a> "; $prevpage = $pageno-1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'>PREV</a> "; }// if echo " ( Page $pageno of $lastpage ) "; if ($pageno == $lastpage) { echo " NEXT LAST "; } else { $nextpage = $pageno+1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'>NEXT</a> "; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage'>LAST</a> "; }// if echo "</td>"; echo "</tf>"; echo "</table>"; mysql_close($con); } } ?>
  4. yeah i hav done all the things earlier but still i am unable to do so. actualyy i'm loading the check boxes dynamically $mLimit = 'LIMIT ' .($mPageno - 1) * $rows_per_page .',' .$rows_per_page; $mQuery = "SELECT * FROM emp $mLimit"; $mResult = mysql_query($mQuery, $mCon) or die('Sorry!Not Connected To Database ' . mysql_error()); while($mRow = mysql_fetch_array($mResult)) { $mEmpno=$mRow['empno']; $mEname=$mRow['ename']; $mJob=$mRow['job']; $mEmail=$mRow['email']; echo "<tr>"; echo "<td><input type='checkbox' id='checkbox[]' name='checkbox[]' value='.$mRow[empno].' > </td>"; echo $mRow['empno']; echo "<td>" . $mRow['empno'] ."</td>"; echo "<td>" . $mRow['ename'] . "</td>"; echo "<td>" . $mRow['job'] . "</td>"; echo "<td>" . $mRow['email'] . "</td>"; echo "<td>" . "<input type='button' name='EDIT' value='EDIT' onclick='return update($mEmpno);'>" ."</td>"; echo "<td>" . "<input type='button' name='DELETE' value='DELETE' onclick='return del($mEmpno);')>" ."</td>"; echo "</tr>"; }
  5. hai, i am displaying the mysql table records with a table in php and placed the checkboxes correspoding to each record and placed abuuton to dlete only the selected record. i have tried in so many ways evn i have used the checkbox array but still facing the same problem and also i have tried to find out the checkbox id whic are displayed in the table but in vain can anybody help me on this regard. Thanks in Advance. kundan
  6. i hav followed with the give link and gone with the same example i created the same example table with the given database name and i was able to display the data but when i selected any record and clicked on delete button nothng was happenning and the checked checkboxes were made unchecked kundan
  7. hello sir, I am displaying the records of mysql table in php and placed checkboxes to delete the selected items i have tried with the issue but in vain . could you please help me how to delete the selected records either with in the same page or by redirecting to another page Thanks in advance kundan
  8. hello sir, how to create class files and how can we include those class files in php?Kindly help me out on this regard Thanks in advance kundan
  9. Thanks alot sir it has worked out using another php page script. but i have directed the new php page by using javascript with window.location <input type='button' name='DELETE' value='DELETE' onclick='return del($empno);')> <script> function del(empno) { var answer = confirm ("Are you sure you want to delete the data ?") if (answer) { window.location="empdelete.php?empno="+empno; return true; } else { return false; } } </script> but instead of directing to another page can we do it in the same page. Kundan
  10. could please tell how to attach the php script to delete button either with on click event or ? Kundan
  11. I am displaying the Mysql tables data in a table along with delete button i want to delete the record when the delete button is clicked with confirmation
  12. Hello Sir. how can we delete a record in php using javascript? i'm using a button control with onclick event but its not working.so please help me out in this regard. Thanks in advance kundan
  13. Hello Sir, how can we delete the records using button control in php.I tried a lot but in vain?please help me out in this regard. Thanks in advance. Kundan
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.