|
If you're doing a Response.Redirect("someUrl"). The redirect will be done on the server side.
That means you're transfering control to the execution of page a.aspx. The former writing of
that script tag is hereby irrelevant.
Cheers
Manfred
|
|
|
|
|
|
Who voted 5 for this unreadable garbage?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
In my Asp.net WebApplication When Im Running A Select Query Im Getting A Error Like This:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I Tried A lot Of Ways For Solving This Problem..But No One worked.
Thanks In Advance,
Vishnu
|
|
|
|
|
vishnukamath wrote: I Tried A lot Of Ways For Solving This Problem.
Have you tried
cmd.CommandTimeout = 10000;
|
|
|
|
|
thanks for replying Me Sir,
Im Using The Select Query to Get the data in to datatable by using dataadapter. when im debugging and when the cursor came to adapter.fill(datatable). it is going into the catch and the error is comming like:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
thanks in advance,
vishnu
|
|
|
|
|
vishnukamath wrote: Im Using The Select Query to Get the data in to datatable
Post the code you are using
|
|
|
|
|
Is the table very large, or are there a bunch of joins in the query?
Are the tables being referenced properly indexed. If they aren't, doing so could substantially increase the performance of the query.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
I would use the MS-SQL Profiler to obtain statistics about the query you are trying to execute. Check the execution plan and verify that you are not doing lots of table (or index) scans.
Your problem also sounds like you might be trying to retrieve too many records at once. How many records are expected to be returned ?
Maybe you should be using a data reader.
Just a few thoughts.
good luck.
|
|
|
|
|
Why Are You Posting Everything In Title Case? Isnt It A Lot Of Work To Keep Pressing The Shift Key At The Start Of Every Word?
|
|
|
|
|
vishnukamath wrote: I Tried A lot Of Ways For Solving This Problem
I don't think you might have tried.
This is a simple problem having simple solution.
SELECT statement inside your program could not be accomplished with the default connection time limit. so Try by increasing connection timeout inside your connection object.
I bet it will work like a charm.
Thanks,
Hiren
Regards,
Hiren.
"We owe a lot to the Indians, who taught us how to count, without which no worthwhile scientific discovery could have been made." - Einstein
Microsoft Dynamics CRM
|
|
|
|
|
hi guys,
i have simple table without primary key that stores two foregin keys. table contains data about which doctor has which patient.
DoctorID | PatientID | 1 | 1 | 1 | 3 | 1 | 4 | 2 | 1 | 2 | 15 |
what i am trying to accomplish is this:
<asp:SqlDataSource ID="sds" runat="server"
ConnectionString="<%$ ConnectionStrings:TestConnectionString %>"
SelectCommand="select * from DoctorPatient"
UpdateCommand="update DoctorPatient set DoctorID=@DoctorID,PatientID=@PatientID where DoctorID=@DoctorID and PatientID=@PatientID">
</asp:SqlDataSource>
<asp:DetailsView runat="server" ID="dv"
DataSourceID="sds" AllowPaging="true"
AutoGenerateEditButton="true">
</asp:DetailsView>
but editing items wont work... can i set SqlDataSource - DetailsView to modify this table without adding primary ID column?
|
|
|
|
|
This is an example of a Join Table and you should define a primary key on it. In this case it will be a composite key consisting of DoctorID and PatientID. Without this you have the potential for multiple entries with the same doctor and patient.
Your update statement makes no sense either. Inserting actual values you can see that nothing will be updated.
UPDATE DoctorPatient
SET DoctorID = 1
PatientID = 3
WHERE DoctorID = 1 AND PatientID = 3
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Is there really just those 2 columns in this table? What does the link represent? How is the UI making changes to this data?
As has already been said you are updating the data with the same values and therefore there will be no visible change. But are you relying on knowing the values that are effectively being deleted?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: Is there really just those 2 columns in this table ?
This is quite common (its called a cross-reference or Xref table), when joining two tables together in a many-to-many fashion. For example a Author can have more than one book, but a book can have multiple authors. If you were to express this in a Database, you'd want to have a two column table as above, additionally, as in the previous post, you'd want to make both columns a [composite] PK.
|
|
|
|
|
Sorry. I didn't quite mean it like that. I know the use of this kind of table and have used many times before. I was more trying to get what it was used for in this instance. Like What is the relationship? Perhaps an appointment. That's why I ask is there no other fields
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Why are you editing? With a table like that the relationship is binary. It exists or it doesn't. There is nothing to edit. All you should need is insert and delete. If patient 15 wants to change doctors from 2 to 1, you should just delete the 2,15 row and add a 1,15 row. Otherwise add a surrogate key. I would suggest adding a surrogate key anyway since there are probably other pieces of data you will want in the future like date. When did the patient start seeing that doctor? That would be good for reporting on things like how many new patients does the doctor get each month.
|
|
|
|
|
As said above your statement doesn't make sense, so please consider the following :
"update DoctorPatient set DoctorID=@NewDoctorID,PatientID=@NewPatientID where DoctorID=@OldDoctorID and PatientID=@OldPatientID"
Please consider other suggestions too before implementing this.
|
|
|
|
|
hi guys, thanks for advice and info, but i found a way how to do this. so if anyone have same problem try this solution:
<asp:SqlDataSource ID="sds" runat="server"
ConnectionString="<%$ ConnectionStrings:TestConnectionString %>"
SelectCommand="
select
DoctorID,
PatientID,
DoctorID as DocOldID,
PatientID as PatientOldID
from
DoctorPatient"
UpdateCommand="
update DoctorPatient set
DoctorID=@DoctorID,
PatientID=@PatientID
where
DoctorID=@DocOldID and
PatientID=@PatientOldID">
</asp:SqlDataSource>
<asp:DetailsView runat="server" ID="dv"
DataKeyNames="DocOldID,PatientOldID"
DataSourceID="sds" AllowPaging="true"
AutoGenerateRows="false"
AutoGenerateEditButton="true">
<Fields>
<asp:BoundField DataField="DoctorID" />
<asp:BoundField DataField="PatientID" />
</Fields>
</asp:DetailsView>
|
|
|
|
|
Hi ,
I need to add OnClick and OndblCick Attributes in RowDataBound event ,
OnClick for get first cell value and store it in Session and OndblCick for redirecting to newpage.aspx.I tried with
below code in RowDataBound, and i'm not using template fields for gridview directly bindig datasource(template fileds not require for me).
e.Row.Attributes["ondblclick"] = ClientScript.GetPostBackClientHyperlink(this.gv_commondataList, "Select$" + e.Row.RowIndex,true);
-----
single Click :
------------
i added one btn_Hidden control in Display none Div tag. This Button Click event firing properly but gv_commondataList_SelectedIndexChanged event not firing on row Double Click
e.Row.Attributes.Add("onclick", "document.getElementById('" + hd_ItemValue.ClientID + "').value=" + e.Row.RowIndex + ";document.getElementById('" + btn_Hidden.ClientID + "').click();");
Could you please suggest me better way to solve my problem.
Regards,
vishnu.
|
|
|
|
|
hi. you can solve problem using asp.net ajax - WebMethods. use this code:
void myGv_RowDataBound(object sender, GridViewRowEventArgs e)
{
string value = e.Row.Cells[0].Text;
e.Row.Attributes["onclick"] = "PageMethods.InitSession('"+value+"')";
e.Row.Attributes["ondblclick"] = "window.location='something.aspx'";
}
[System.Web.Services.WebMethod()]
public static void InitSession(string value)
{
Page page = (System.Web.HttpContext.Current.CurrentHandler as Page);
page.Session["Test"] = value;
}
and add this markup on your aspx
<asp:ScriptManager runat="server" ID="sm" EnablePageMethods="true" />
|
|
|
|
|
Hi,
I am new to asp.net.I am using ajaxtabcontainer and ajax tabpanel to generate 4 tabs in the aspx page.But here after the tabs some extra space is generated and that has to be removed.Actualy i have written a code for sitemap.So in between tabs and sitemap space should not be present.I have tried with valign="bottom" but it didnot help.Could you please help me in this regard.
I have pasted my aspx code below.
<pre><table cellpadding="0" cellspacing="0" border="0" >
<!-- Ajax tab container -->
<tr style="background-color: Transparent;" valign="bottom" >
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajaxToolkit:TabContainer ID="tabcontainer" runat="server" BorderWidth="0" CssClass="ajaxtab">
<td width="50">
</td>
<td>
</td>
<td>
</td>
<td valign="bottom">
<ajaxToolkit:TabPanel ID="tabAdmin" runat="server">
<HeaderTemplate>
<div>
<asp:ImageButton ID="ibtnAdmin" runat="server" Height="100%" ImageUrl="/images/Tabs/admin_blue.jpg"
OnClick="ibtnAdmin_Click" />
</div>
</HeaderTemplate>
</ajaxToolkit:TabPanel>
</td>
<td>
</td>
<td valign="bottom">
<ajaxToolkit:TabPanel ID="tabConfiguration" runat="server">
<HeaderTemplate>
<div>
<asp:ImageButton ID="ibtnConfiguration" runat="server" Height="100%" ImageUrl="/images/Tabs/configuration_blue.jpg"
OnClick="ibtnConfiguration_Click" />
</div>
</HeaderTemplate>
</ajaxToolkit:TabPanel>
</td>
<td>
</td>
<td>
</td>
<td valign="bottom">
<ajaxToolkit:TabPanel ID="tabReports" runat="server">
<HeaderTemplate>
<div>
<asp:ImageButton ID="ibtnReports" runat="server" Height="100%" ImageUrl="/images/Tabs/report_blue.jpg"
OnClick="ibtnReports_Click" />
</div>
</HeaderTemplate>
</ajaxToolkit:TabPanel>
</td>
<td>
</td>
<td valign="bottom">
<ajaxToolkit:TabPanel ID="tabSimulation" runat="server">
<HeaderTemplate>
<div>
<asp:ImageButton ID="ibtnSimulation" runat="server" Height="100%" ImageUrl="/images/Tabs/simulation_Blue.jpg"
OnClick="ibtnSimulation_Click" />
</div>
</HeaderTemplate>
</ajaxToolkit:TabPanel>
</td>
<td width="50">
</td>
<td>
</td>
<td>
</td>
</ajaxToolkit:TabContainer>
</tr>
</table>
</div>
</td>
</tr>
<tr valign="top">
<td align="center" colspan="2" valign="top">
<div id="divSiteMap">
<table class="SiteMapBars" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="right" valign="middle">
<table border="0" width="100%" cellpadding="6" cellspacing="0">
<tr>
<td align="left" valign="middle">
<asp:SiteMapPath ID="smpLinks" runat="server" Font-Names="Verdana" Font-Bold="true"
Font-Size="X-Small" PathSeparator=" >> ">
<PathSeparatorStyle Font-Bold="True" ForeColor="#990000" Font-Size="Smaller" />
<RootNodeStyle Font-Bold="True" ForeColor="#FF8000" />
<NodeStyle Font-Bold="True" ForeColor="#284E98" />
<RootNodeStyle Font-Bold="True" ForeColor="#FF8000" />
<CurrentNodeStyle ForeColor="#333333" />
</asp:SiteMapPath>
</td>
<td align="right">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr></pre>
|
|
|
|
|
Please use
Firefox => yslow + firebug
IE => pressing f12 and find element (ctrl+ b)
Chrome => right click + inspect element
to find out what exactly is the cause - after that it will be a matter of little CSS modification...
|
|
|
|
|
Thanks a lot for the reply.I found the solution by giving "ImageAlign=AbsBottom" in ImageButton.
|
|
|
|
|
Hi,
I have one more doubt.I got the solution for my previous problem with your help , but now I have one more issue.Inside each ajax tab panel I have written ImageButtons which redirects to corresponding aspx pages.Now here I want to change the imageurl of the ImageButton after once it is clicked to indicate that ajax tab is active by using Ativetabchanged event ofajax tabcontainer.Since I have Response.Redirect in my codebehind it is not going to that event only.I can't use content template here because I need respective home pages for all the modules and hence i must need Imagebuttons for Redirecting.So how to change the Imageurl of that ImageButton ? Please help me in this regard.
Aspx code
------------------------------
<ajaxToolkit:TabContainer ID="tabcontainer" runat="server" BorderWidth="0" CssClass="ajaxtab" OnActiveTabChanged="tabContainer_ActiveTabChanged">
<ajaxToolkit:TabPanel ID="tabAdmin" runat="server">
<HeaderTemplate>
<asp:ImageButton ID="ibtnAdmin" runat="server" ImageAlign="AbsBottom" ImageUrl="/images/Tabs/admin_blue.jpg"
OnClick="ibtnAdmin_Click" OnClientClick="this.src='/images/Tabs/simulation_Gray.jpg'"/>
</HeaderTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabConfiguration" runat="server">
<HeaderTemplate>
<asp:ImageButton ID="ibtnConfiguration" runat="server" ImageAlign="AbsBottom" ImageUrl="/images/Tabs/configuration_blue.jpg"
OnClick="ibtnConfiguration_Click" OnClientClick="this.src='/images/Tabs/simulation_Gray.jpg'" />
</HeaderTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabReports" runat="server">
<HeaderTemplate>
<asp:ImageButton ID="ibtnReports" runat="server" ImageAlign="AbsBottom" ImageUrl="/images/Tabs/report_blue.jpg"
OnClick="ibtnReports_Click" OnClientClick="this.src='/images/Tabs/simulation_Gray.jpg'" />
</HeaderTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabSimulation" runat="server">
<HeaderTemplate>
<asp:ImageButton ID="ibtnSimulation" runat="server" ImageAlign="AbsBottom" ImageUrl="/images/Tabs/simulation_Blue.jpg"
OnClick="ibtnSimulation_Click" OnClientClick="this.src='/images/Tabs/simulation_Gray.jpg'" />
</HeaderTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
aspx.cs
-------------------
protected void tabContainer_ActiveTabChanged(object sender, EventArgs e)
{
if (IsPostBack)
{
switch (tabcontainer.ActiveTab.TabIndex)
{
case 0: ibtnAdmin.ImageUrl = "/images/Tabs/simulation_Gray.jpg";
break;
case 1: ibtnConfiguration.ImageUrl = "/images/Tabs/simulation_Gray.jpg";
break;
case 2: ibtnReports.ImageUrl = "/images/Tabs/simulation_Gray.jpg";
break;
case 3: ibtnSimulation.ImageUrl = "/images/Tabs/simulation_Gray.jpg"; ;
break;
}
}
}
|
|
|
|