|
now it gives me this error.
The data source does not support server-side data paging
Mamphekgo
|
|
|
|
|
Mamphekgo wrote:string conString = @"Data Source=jakes;Initial Catalog=K2;User ID=sa";
I think in ur constring database server name is missing, try to include the server name.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
Will @ symbol comes in the connction string.
Mostly the @ symbol will be used for c# coding while giving long path of the source file where two slashes should be used.
Eg: in C# - @"C:/Myfolder/DBname"; or we can write "C://Myfolder//DBname";
Check without using the @ symbol.
VanithaVasu
|
|
|
|
|
is there any diffeence between database/initial catalog
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
no is the samething
Mamphekgo
|
|
|
|
|
mamphekgojakes wrote: i am trying to display data on a gridview but it doesn't display anything and it doesn't give any error.
here is my code
1. Is your select query returning values in query analyzer ?
2. What is your page size ? Try commenting the allow paging line.
3. Put break point and ensure your dataset contains rows.
|
|
|
|
|
I am having two image buttoms - One is ADD button and another is Delete Button, and two dropdownlists one with project names and another ddl with task names of the particular project.
1.) I click the project and onSelectedIndexchanged of project i get the task names and from the tasks i select one task.
2.) Now i want to add new row to the datagrid and when i add i create a row dynamically.
But the values in the previous rows disappear. How do i maintain the selected values of the controls during runtime even if i add aor delete rows.
Can u please help me to find out the solution.
VanithaVasu
|
|
|
|
|
Check when your grid is being filled!
Normally binding values to datagrid would be done in the pageload and when it is not post back.
gauthee
|
|
|
|
|
I have filled my grid and i have written my code after post back only.
here is my code
if(e.Item.ItemType==ListItemType.Item)
{
if(Flag==true)
{
DropDownList drop=(DropDownList)e.Item.FindControl("dd1");
drop.SelectedValue=ddlSelectText;
cmd1=new OleDbCommand("select ptTask from Tasks where ptId="+taskid+"",con);
}
else
{
cmd1=new OleDbCommand("select ptTask from Tasks where ptId=1",con);
}
con.Open();
rd1=cmd1.ExecuteReader();
while(rd1.Read())
{
ddltasks.Add(rd1.GetValue(0).ToString());
}
con.Close();
if(Flag==true)
{
DropDownList tasklist=(DropDownList)e.Item.FindControl("dd2");
tasklist.DataSource=ddltasks;
tasklist.DataBind();
}
This is my code where i have written in datagrid_ItemBinding.Also this is the page load also. But when i add a new row i get the new row but i didnt get any value which i have set for my previous row.
I should get the value be maintained.
What should i do?
VanithaVasu
|
|
|
|
|
VanithaVasu wrote: Now i want to add new row to the datagrid and when i add i create a row dynamically.
But the values in the previous rows disappear. How do i maintain the selected values of the controls during runtime even if i add aor delete rows.
To understand your problem you need to be familiar about how ASPX page works and ASP.NET page lifecycle. MSDN is having good articles regarding this.
Regarding your problem, You are not getting previous values when new row added because, ASP.NET is not maintaining viewstate for your control. This is happening because you are creating dynamic columns somewhere after Init event. When an ASPX page processes, it will store viewstates in Init event. So whatever dynamic controls created after this event won't maintain viewstate.
To solve your problem, try creating the rows in page_init event. Remember when you create controls in init event, no need to check isPostBack
|
|
|
|
|
It's a repost. I tried different combinations with the problem. But I couldn't find out where I am going wrong.
I created a class which checks session and redirects to login page. My class looks like this. This class inherits Page class to get access to session object.
public class CAuthentication:System.Web.UI.page
{
public CAuthentication()
{
if ( Session["login"] == null )
Response.Redirect("expired.aspx");
}
}
My ASPX.CS looks like
public partial class MyPage:CAuthentication
{
}
This is not working. I am getting error "session can't be used inside a class" . What is wrong here ? Normally codebehind file used to inherit System.Web.UI.Page , Instead of this I inherited this in my CAuthentication class. Where I am going wrong ?
|
|
|
|
|
you dont have to inherit CAuthentication class instead let it be System.Web.UI.Page . You have to assign the session value as null in the session_start ,in the Global .asax.cs file . And also u have to assign the values in the page_load where it can be processed when the session is not null.
VanithaVasu
|
|
|
|
|
VanithaVasu wrote: You have to assign the session value as null in the session_start ,in the Global .asax.cs file
What do you mean ?
I think you are telling to check session null in each page load. right ? To avoid that I have written this one.
|
|
|
|
|
Hi
In my application I got two columns,one is for Serial No. other one is for CheckBox.
I have get value from DataBase and fill into this DataGrid,for Serial No. I have Interger column in DataGrid and for CheckBox Tinyint.For CheckBox column in DataGrid values r 0 and 1.
My problem is that I have to get both the values simultaneously, if the value in CheckBox column is 1 then the CheckBox in the DataGrid should check,if it is 0 it should uncheck.
How can I get Serial No. in one column and checking of CheckBoxes in another.
What shuold I use for Getting values from DataBase; DataReader or DataSet
Plz suggest me an example.
I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison
Thank u
Chandu
|
|
|
|
|
After binding grid, you can iterate through the grid rows by checking your condition. If your condition satisfies, get the checkbox id and check it.
Or you can use ItemDatabound event for datagrid. Datagrid will fire this event when each row created. In this event you can take serial number from datagrid, do a select to your table and check the checkbox depends on value.
chand10 wrote: What shuold I use for Getting values from DataBase; DataReader or DataSet
I prefer DataSet
|
|
|
|
|
Hi Friends,
For my client I have to develop a smart client application. But what is a Smart Client Application and which template should I use for that. Please suggest me.
Thanks in advance.
Thanks,
Arindam D Tewary
|
|
|
|
|
I gotta tell you, if you don't even know what a smart client application is, and if you can't use google to find out, then no template is going to enable you to meet your clients expectations. Your best move is to tell the client you don't know how to do it now, not when they are expecting you to deliver something.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I would like know why ASP.Net has introduced the new directories and what is their significance. Are they meant for just logical seperation and to help in easily organising stuff or any other strong reason. And if we consider app_code folder which is meant for code files like .cs, .vb etc. What if I place any codefile outside of this folder.Because when I placed a .cs file in app_code folder and tried to compile it it was not compiling.
Can someone let me know what these folders are really for...
Thanks:
Rakesh
|
|
|
|
|
rockyl wrote: Are they meant for just logical seperation
It's ASP.NET 2.0 or later architecture.
rockyl wrote: And if we consider app_code folder which is meant for code files like .cs, .vb etc. What if I place any codefile outside of this folder
If you want to share some classes in whole application, you can keep them inside app_code. Classes inside app_code will be compiled automatically at runtime. ASP.NET treats whole app_code as single assembly.
rockyl wrote: I placed a .cs file in app_code folder and tried to compile it it was not compiling.
What was the error you are getting ?
|
|
|
|
|
Hi,
I am trying to print a document and then save it!
I first opened the document using Open(ApplicationClass, Word..) then
I activated the printer which is required then
I used printoutold
After printing a dialog box appears asking the user to enter a name to save the printed file.
Is there a way that i could avoid this user interaction and give the name of the file directly so that after printing it directly saves at the given location.
gauthee
|
|
|
|
|
|
Hi all, I get the following error when trying to build my website but can't figure out why.
error CS1002: ; expected
<%for(int a = 0; a < AdItems.Tables[0].Rows.Count; a++)
{
%>
<tr>
<td>
<div class="casinopromotions"><img src="<%=ResolveUrl(AdItems.Tables[0].Rows[a]["image_url"].ToString()) %>" alt="<%=AdItems.Tables[0].Rows[a]["image_alt_text"].ToString() %>" width="<%AdItems.Tables[0].Rows[a]["image_width"].ToString() %>" height="<%AdItems.Tables[0].Rows[a]["image_height"].ToString() %>" />
</div>
</td>
</tr>
<%
}
%>
Any suggestions and pointers to possible causes will be greatly appreciated
Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Don't worry, I found my problem. I did not include the = after the <% for width and height
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
I would rather suggest a CodeBehind check instead of using IF ELSE in .ASPX page increasing the clutter.
|
|
|
|
|
Its just one for loop, not if else, but will check if I can do it in codebehind, thanks for the suggestion
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|