|
Abhijit Jana wrote:
MarkMokris wrote:
What about if I set up a SQLDataSource at design time and bind it to a GridView. Is the SQLDataSource reconnecting and rerunning the SQL with every post-back? Even post-backs that do not involve the GrdiView?
Yes. You have to very much clear about asp.net page lifecycle and PostBack Property.
I tought that:
The sql statement wont be executed on every postback, just the first time. On postbacks caused by other controls, the gridview will be regenerated from its view state
If the gridview causes a postback, something like sorting or paging, or you call databind, then it will re execute the sql statement again
Alexei Rodriguez
|
|
|
|
|
Alexei,
AlexeiXX3 wrote: The sql statement wont be executed on every postback, just the first time. On postbacks caused by other controls, the gridview will be regenerated from its view state
It depends on how you set DataSource to the GridView . If it is set in the markup, like the below
<asp:GridView ID="grd" runat="server" DataSourceID="sql_ds_id">
.....
</asp:GridView> GridView will be regenerated on each postback. You can workaround this by removing the DataSourceID="sql_ds_id" from markup and binding from code when required. Then it will be loaded from ViewState each time. Other way is to enable caching on SqlDataSource .
|
|
|
|
|
N a v a n e e t h wrote: GridView will be regenerated on each postback.
It will be regenerated, but not by executing the sql statement again, it will be regenerated from the viewstate. You can use the sql profiler, or just put a breakpoint in the selecting event of the sqldatasource
I have the following code, and it only executes the SQL statement the first time the page is requested but not on postbacks caused a test button on the same page
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True"
SortExpression="ID" />
<asp:BoundField DataField="Name" HeaderText="Name"
SortExpression="Name" />
</Columns>
</asp:GridView>
SqlDataSource1 doesnt have caching enabled
Alexei Rodriguez
|
|
|
|
|
MarkMokris wrote: Any variables I create global to the page class will be re-initialized with each post-back. Is that correct?
Yes
MarkMokris wrote: Does that mean that nothing really persists from post-back to post-back?
As Christian said, static variables will be persisted as static variables are destroyed only when the application domain which hosts ends. ASP.NET provides many other persistent mechanisms. Beginners Introduction to State Management Techniques in ASP.NET[^] will get you started.
MarkMokris wrote: What about if I set up a SQLDataSource at design time and bind it to a GridView. Is the SQLDataSource reconnecting and rerunning the SQL with every post-back? Even post-backs that do not involve the GrdiView?
Yes if caching is not enabled on SqlDataSource . Using SqlDataSource other than academic purpose is not recommended. It forces you to write SQL inside your markup. There are better ways to get data and do binding.
|
|
|
|
|
[Asp.Net 2.0 + C#.Net]
i have 2 textbox controls
assume
TextBox1 is 150
then in
TextBox2 one hundred and fifty
i need to display
suppose
TextBox1 is 19999
then in
TextBox2 Nineteen thousand nine hundred ninety nine
i need to display
how to do,help me out....
|
|
|
|
|
katarukoti wrote: i have 2 textbox controls
assume
TextBox1 is 150
then in
TextBox2 one hundred and fifty
i need to display
suppose
TextBox1 is 19999
then in
TextBox2 Nineteen thousand nine hundred ninety nine
i need to display
Is this your homework ?
|
|
|
|
|
|
hello everyone...
anybody who can help me how to use a third party OCX in my ASPX... said OCX is a UI and was developed in VB6.
I want to use in in my ASPX(C#) page. I tried to add it as a compnent but it doesn't work.... I need it badly for my new project.... Thanx in advance....
xxx
|
|
|
|
|
|
I think i have to read the link thoroughly.... this might help me to solve my problemm.... Thank you very much...
xxx
|
|
|
|
|
thank you for helping me solve my problem... the links u gave realy helped a lot....
xxx
|
|
|
|
|
I have a gridview
i want to capture the gridview cell value to a int varible.
i wrote the code as below
int s=0;
for (int i = 0; i < GvFeeTransaction.Rows.Count - 1; i++)
{
CheckBox c = ((CheckBox)(GvFeeTransaction.Rows[i].FindControl("ChkSelect")));
if (c.Checked)
{
if (GvFeeTransaction.Rows[i].Cells[4].Text.Trim() != " ")
{
s = s + int.Parse(GvFeeTransaction.Rows[i].Cells[4].Text);
s = s + Convert.ToInt32(GvFeeTransaction.Rows[i].Cells[4].Text);
s =s+(int)(GvFeeTransaction.Rows[i].Cells[4].Text);
}
else
{
s = s + 0;
}
}
}
nothing is working perfectly means int.parse,convert.toint32,(int)-------
it is showing
Input string was not in a correct format.
i want the sol for this one
i need the answer let me know the exact sol from u.
|
|
|
|
|
Put a try catch block around this statement
s = s + int.Parse(GvFeeTransaction.Rows[i].Cells[4].Text);
and also put a break point on the catch block. Check whether it returns a value that cannot be converted into a number.
|
|
|
|
|
GvFeeTransaction.Rows[i].Cells[4].Text
It looks right
maybe you are counting the columns wrong
Make sure you dont have any invisible columns, because those columns count as well
The easiest way is to put a breackpoint and try different column indices in the immediate window to check wichone has the correct column
Or try this: GridView1.HeaderRow.Cells[4].Text to see the header text
Alexei Rodriguez
|
|
|
|
|
My aim is to browse a asp.net app thats hosted in my pc's iis, on my windows mobile browser. For this is use the URL which is something like:
http://MachineName/AppName/default.aspx
The error message I get is, "The Page cannot be displayed or downlaoded because the connection was lost. Check the connction and try again later."
I have a i-Mate PDAL mobile with windows mobile 5.0 and .Net framework 3.5 installed, which i connect to the pc which is hosting the asp.net web app using a USB cable.
Now the queries i have are:
- How does windows mobile resolve urls and how do i set a DNS server for the mobile?
- if i browse to '\\MachineName' on the mobile browser, its shows me the shared folder of my pc on mobile browser. So why it cannot access the web app's url?
- i tried a couple of settings in the Connections settings of the mobile, but didn't work. Any thing specific i need to do?
Thanx.
s.a.w.
|
|
|
|
|
Try using your PCs IP: 192.168.1.120/Appname/PageName.aspx
And make sure you have a conection, just to make sure, try to open any page like google.com
Alexei Rodriguez
|
|
|
|
|
Thanx, for the reply. But it doesn't work using IP either.
s.a.w.
|
|
|
|
|
Hi,
I have a requirement in my project which is to place a panel on a windows form and then to select particular area on it using mouse. then we have to display a image in this selected area on the panel with the selected dimensions.
If anyone have idea to solve this please reply me.
Thanks in advance.
|
|
|
|
|
If you can select an arbitrary area in a web app, you can't do it with ASP.NEt, you need javascript.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Nekkantidivya wrote: windows form
wrong forum, try this[^]
|
|
|
|
|
Hi all,
How to generate html control object based on the given string. (string contains the proper html tags, this string is actually generated from rendercontrol function of a webcontrol).
Please help me out on this .
thanks,
Zaki
|
|
|
|
|
I am unable to get your question, Can you please elaborate it a bit?
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
I have a field in the database which holds the html content of a web control (for example Emploee Name). Bsed on this string content i need to identify the type of a webcontrol and get all its assigned properties along with the values of each property.
we can get the assigned properties and values by using GetType() and GetProperties() functions. All i need is how to convert the string content to html control.
One way is to parse the string and identify the type of a control by looking at Type attribute.(exmple ).
But this shouldn't be the best way to achive this .
please help me.
|
|
|
|
|
i need code for displaying the data in gridview
|
|
|
|
|