|
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;
}
}
}
|
|
|
|
|
|
Good Day All
i have 20 Textboxes i am not sure what did i touch by i normally dont play with VS Settings i dont understand. So those textbox are normally defined like this
<asp:TextBox ID="txtUnitLen20" onKeyUp="Jump()" runat="server"
TabIndex="19" AutoPostBack="True"></asp:TextBox>
SerialsText.Add(txtUnitLen1.Text);
but if the value that is entered is "1" , there i will get this as a Value hex like this
[0x00000001] = "1";
Please note that the Textbox gives me "1" but the List gives me those Numbers
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Thanks for moving this.
Can you tell us what SerialsText is. txtUnitLen1.Text will just be the string "1" so the problem probably lies with the SerialsText object.
|
|
|
|
|
Good Day Keith
SerialsText is a List<string> and yes the textbox will give "1" , but when i am adding the value to the List<string> the value changes. I have attached a link to a screenshot that shows the watch of the List
http://www.vbforums.com/attachment.php?attachmentid=81284&stc=1&d=1291022277[^]
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I know it's confusing, but that (0x00000001) is the way that quickwatch displays integers, so in that sense there is nothing wrong. It looks hex but it isn't.
Vuyiswa Maseko wrote:
SerialsText.Add(txtUnitLen1.Text);
but if the value that is entered is "1" , there i will get this as a Value hex like this
[0x00000001] = "1";
Here 0x00000001 is the index of the item in SerialsText not the value itself, so for example if you entered 2 into the same textbox, this will appear as:
[0x00000001] = "2";
Note one thing: the value is "2" (a string) rather than 2 (an integer). You might need validation on your input, and to cast the value to an integer, depending upon your requirements.
Hope this helped!
|
|
|
|
|
Hey,
I am facing a problem.
When i run "exec sp_databases",it returns only system databases.
|
|
|
|
|
First, this should be in the database forum as it has nothing at all to do with ASP.NET.
Second, does the user account you are running this query under have access to the databases you are expecting to see?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Oh!You are right.It should be in database section.
I am running it under administrator rights.
|
|
|
|
|
so... maybe i'm doing something wrong but i'm having no luck checking if the uploaded file length is greater than i want to allow before an exception is thrown and the site crashes
i thought "Request.ContentLength" would allow me to filter out stuff that s too big and give a friendly error message to the user but, as i said, the site crashes with an exception
i have looked but can find no way to handle this exception gracefully ... any ideas gratefully received
also, please don't tell me to make the max upload allowed bigger ... that doesn't really solve the problem
the files are only supposed to be less than 1mb or so
thanks
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
|
|
|
|
|
any more detail will help - please try handling on error event @ global.asax...
|
|
|
|