|
iam having a page where iam having nearly 5 textboxes and two radiou buttons and 5 ddls now iam having a value form hidden field .if the hidden field value is 1 then i should not allow user not to edit any control in that page .how it is possible...if hidden field value is 0 then he can edit the page.
|
|
|
|
|
Just check what the value is and then set the fields to enabled = false
|
|
|
|
|
I am using <asp:Table> control. and displaying data dynamically. but i want to give Pageing in this table.. then Please suggest me how to give pageing in asp table.
Thanks
modified on Thursday, July 17, 2008 6:35 AM
|
|
|
|
|
raushan_9 wrote: I am using <asp:table xmlns:asp="#unknown"> control. and displaying data dynamically. but i want to give Pageing in this table.. then Please suggest me how to give pageing in asp table.
Follow these steps
Step 1: Add one column field in DataTable
Retrieve Data from database and add one column in this datatable using asp.net and increament it by 1.
Suppose you have 100 records so that field values should be 1 to 100
Step 2:Set property
Create three properties CurrentPage, PageSize and PageCount
PageCount is total number of record
PageSize to display number of record on page
CurrentPage is PageIndex
Set these three properties value on page load event after retrieving data from database and add column field in this datatable
Step 3:Take two link Button
Take Previous and Next Link button
Step 4:Get record from DataTable and bind asp table
Before calling this,you must add one column field in datatable so you can get number of record
Suppose,You have 100 record and you have set pagesize 10
first time CurrentPage should be 1
You can get 1 to 10 record from datatable by using select method of datatable
Suppose you add one column with ID,then your code looks like this
you can get "to" to "from" value by this
int t=(CurrentPage-1)*PageSize;
int f=CurrentPage*PageSize+1; 1*10+1=11
DataRow[] dRow=dataTable.Select("ID>"+t+" and ID<"+f);
the Above line will return you first ten record,you can bind your asp table with these 10 records
step 5: On Next Link Button event
On Next Button event, increament CurrentPage
Suppose at first time you click on Next Button,CurrentPage increament by 1.
now currentPage is 2
calculate again "to" to "from" value
int t=(CurrentPage-1)*PageSize;
int f=CurrentPage*PageSize+1; 2*10+1=21
DataRow[] dRow=dataTable.Select("ID>"+t+" and ID<"+f);
you can loop through DataRow array and get value from it and bind your asp table
the Above line will return you second 11 to 20 records
Now check here
if PageCount/PageSize is less then currentpage then disable next link button
Suppose you have 99 records your current page 10 then it display 90 to 99 records.Next you have not record so it should be disbled.
Step 6:On previous link button
at first time, when CurrentPage is 1,Privous button link should be disabled.
Same thing here.you have to decrease CurrentPage and process will be same
Note : Store current page in ViewState so you can get it from it other wise it will set default.
I hope this will help you
best of luck
please don't forget to vote on the post that helped you.
|
|
|
|
|
i want to create a feild in sql server2005 database table during runtime using c# web application coding
|
|
|
|
|
Is there a way to reorder leaf nodes in treeview like drag&drop but i do not want to use third party controls? Can i simulate drag&drop with buttons? My treview is bind to XMLDataSource Data property and hierarchical table in SQL database. When i reorder nodes i must save that in database to.
|
|
|
|
|
Hi friends,
I am familiar in Asp.net. I have a php script code for flash uploading. I need to convert this php script to java script. For ur's reference i put the code below,
include("JSON.php");
$result = array();
if (isset($_FILES['photoupload']) )
{
$file = $_FILES['photoupload']['tmp_name'];
$error = false;
$size = false;
if (!is_uploaded_file($file) || ($_FILES['photoupload']['size'] > 2 * 1024 * 1024) )
{
$error = 'Please upload only files smaller than 2Mb!';
}
elseif (!$error && !($size = @getimagesize($file) ) )
{
$error = 'Please upload only images, no other files are supported.';
}
elseif (!$error && !in_array($size[2], array(1, 2, 3, 7, 8) ) )
{
$error = 'Please upload only images of type JPEG.';
}
elseif (!$error && ($size[0] < 25) || ($size[1] < 25))
{
$error = 'Please upload an image bigger than 25px.';
}
else {
move_uploaded_file($_FILES['photoupload']['tmp_name'], "./uploadedfiles/".$_FILES['photoupload']['name']);
chmod("./uploadedfiles/".$_FILES['photoupload']['name'], 0777);
}
$addr = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$log = fopen('script.log', 'a');
fputs($log, ($error ? 'FAILED' : 'SUCCESS') . ' - ' . preg_replace('/^[^.]+/', '***', $addr) . ": {$_FILES['photoupload']['name']} - {$_FILES['photoupload']['size']} byte\n" );
fclose($log);
if ($error)
{
$result['result'] = 'failed';
$result['error'] = $error;
}
else
{
$result['result'] = 'success';
$result['size'] = "Uploaded an image ({$size['mime']}) with {$size[0]}px/{$size[1]}px.";
}
}
else
{
$result['result'] = 'error';
$result['error'] = 'Missing file or internal error!';
}
if (!headers_sent() )
{
header('Content-type: application/json');
}
echo json_encode($result);
?>
In the above code a temporary file created and the uploaded files are stored in that folder.I need to convert this code in javascript.
I hope ur's reply
Thanks
Every Successful Person Have A Painful Story
|
|
|
|
|
You would be better of posting this on a javascript forum
Also php is server side language and javascript is client side, how are you going to convert that?
|
|
|
|
|
Hi All,
How can I open a new popup windoe on the click of the hyperlink in an popup window.
When I tried opening a new popup window form another popup window, it opened the popup window in the same window and not a new one.
Please help.
|
|
|
|
|
|
HI,
I am a web developer. I need to build search engine for my web page where user enter keyword for search .If user enter "m" it will show previous all keywords of m from the database in a pop up window below the search text box.
Please anyone could help me to solve the problem.
|
|
|
|
|
M. K. BASHER wrote: Please anyone could help me to solve the problem.
Use AJAX Autocomplete Extender control.
Search in google for sample code.
please don't forget to vote on the post that helped you.
|
|
|
|
|
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx
|
|
|
|
|
|
|
Actually My search engine will act as.......
If i put m then it will show........
Man
Mouth
Mouse
Market
.
.
.
And then one of these keyword can be select
|
|
|
|
|
Hi
I was hoping to set up a hit counter using html or javascript but Ive read a few articles saying this is not possible. If this is wrong does any1 know any good tutorials for a hit counter?
If you have to create a hit counter using a server side language does any1 know any good tuturials for this?
thanks!
|
|
|
|
|
small idea.
Log in each page_load in if(!Page.IsPostBack) a line that can be saed in a database. With a query on that DB you can do a count on the page.title (for all or just for the current user?) and show it as a counter.
|
|
|
|
|
I used sqlcachedependency with table in sqlserver2005
and it works well but
suddenly I opened page in debug mode and tried to change some
configuration setting for testing purposes while the page is running
and when I pressed ctrl + S to save changes
the oncacheitemremoved event called many time with reason (dependencychanged)
untail the stack overflow exception raised .
where is the problem .
even if the application rebuild it self what is the relation
between what the clr do when i save changes && the oncacheitemremoved .
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
I'm trying to make limited access for all users anonymous or ahuthenticated To specific folder ...
Now the problem is that folder contain web services and script file
that will called from many pages .
I put the follwoing deny tag authoraization tag in Config file in that folder .
deny users="*"
Now the result is that all files in folder will not accessed
from any users but also will not called from any pages
I want to prevent users just to open or download the files
but I want to allow pages that users open to call the scripts & web services .
I hope that I explained the problem sorry about my my long "story" question .
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
Hi,
I have a local report running in asp.net 2 reportviewer. When I use the export to excel functionality of the reportviewer control, the numbers are exported as text in excel and I can not apply excel functions on the number fields. Do you know if there is a certain format I can use for excel to know its a number field. I used =FormatNumber(Fields!Balance.Value) AND
=Format(Fields!Balance.Value,"### ### ##0.00") AND
=Format(Fields!Balance.Value,"###,###,##0.00") none working. I removed the format all together and it still didn't make a difference.
Please assist
|
|
|
|
|
Did you use CDec(Fields!Balance.Value)
|
|
|
|
|
i will provide this code to user.. if u are save this code in .html format.. to play the video file....
but it is not play... help me
<object width="100%" height="100%">
<param name="movie" value="http://localhost:4337/WebSite1/Default.aspx?file=ss/one.flv" />
<embed src="http://localhost:4337/WebSite1/Default.aspx?file=ss/one.flv" type="application/x-shockwave-flash" width="425" height="350"></embed>
|
|
|
|
|
Can Anybody tell me, the good website name for learning asp.net completely?
|
|
|
|
|