|
Hi,
I am having two table which are related with primary and foreign key constraints. I want to delete records from both the tables using innerjoin.
I applied like this,
delete sports,studentregtable
from studentregtable as sr
INNER JOIN sports sp ON sr.registerNo = sp.RegisterNumber
where RegisterNumber = '123'
but it is giving an error like incorrect syntax near ",".
can you please help me if you know the solution.
|
|
|
|
|
dayakar_dn wrote: can you please help me if you know the solution.
First you help me understand that how is this related to ASP.Net?
btw, We have a seperate forum [^]for database.
dayakar_dn wrote: delete sports,studentregtable
from studentregtable
And how can you delete a table(studentregtable) from table?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hello,
I currently have two dropdown lists in an edit item template and I have hard coded the values for the lists. The Item Template is a label that would read the value that was selected. That value would when be sent to a database.
When I hit edit, the dropdown lists appear, and I change the value. When I hit update, the Item Templates do not update with the selected values, and when I hit edit again, the values are back to the default, not what I selected. Can someone help me figure out how to fix this? The code is below, thanks for your time.
<asp:GridView ID="GridView_Service_Tower_Configuration_Options"
runat="server" AutoGenerateColumns="False"
DataSourceID="DS_Configuration_Options" CellPadding="4"
GridLines="None" Width="600px"
DataKeyNames = "category" ForeColor="#333333">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:CommandField ShowEditButton="true" />
<asp:BoundField DataField="category" HeaderText="Service Tower"
SortExpression="Category" ReadOnly="True"/>
<asp:CheckBoxField DataField="include" HeaderText="New Service Provider"
SortExpression="include" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:CheckBoxField>
<asp:TemplateField HeaderText="Transition Year"
SortExpression="Transition Year">
<EditItemTemplate>
<asp:DropDownList ID="drpTransitionYear" runat="server" Width="70px">
<asp:ListItem>2010</asp:ListItem>
<asp:ListItem>2011</asp:ListItem>
<asp:ListItem>2012</asp:ListItem>
<asp:ListItem>2013</asp:ListItem>
<asp:ListItem>2014</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("purchase_year") %>'></asp:Label>
</ItemTemplate>
<ControlStyle Width="60px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Transition Schedule"
SortExpression="Transition Schedule">
<EditItemTemplate>
<asp:DropDownList ID="drpTransitionSchedule" runat="server">
<asp:ListItem Selected="True">1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("transition_years") %>'></asp:Label>
</ItemTemplate>
<ControlStyle Width="50px" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="DS_Configuration_Options" runat="server"
ConnectionString=""
SelectCommand="populate_dashboard"
SelectCommandType="StoredProcedure"
UpdateCommand="exec update_dashboard @SessionID, @category, @include, @purchase_year, @transition_years"
OnUpdated="UpdateTotals_Updating">
<SelectParameters>
<asp:SessionParameter Name="SessionID" SessionField="SessionID"/>
</SelectParameters>
<UpdateParameters>
<asp:SessionParameter Name="SessionID" SessionField="SessionID"/>
<asp:FormParameter Name="category" FormField="category" />
<asp:FormParameter Name="DropDown" FormField="include" />
<asp:FormParameter Name="purchase_year" FormField="purchase_year" />
<asp:FormParameter Name="transition_years" FormField="transition_years" />
</UpdateParameters>
</asp:SqlDataSource>
|
|
|
|
|
How to add multiple images in crystal report? all the images is in image folder.
|
|
|
|
|
payaldonga wrote: How to add multiple images in crystal report? all the images is in image folder.
What have you tried so far?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
easiest way is to store the images into a database or in a dataset
create a subreport within the main report that display the images per detail section row...
you could add another field in the datarow to determine the order of the images..
Remember to tick the can grow checkbox for the image to display in their full size...
|
|
|
|
|
Is there a way in JavaScript to detect if the users press Shift + :?
The below code does not seem to work.
if (event.shiftKey && event.keyCode == 186)
event.keyCode = 9;
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" >
<input type=text id="txtBox" onkeyup="test()">
<script>
<!--
function test() {
if (document.getElementById("txtBox").value == "+")
{
myalert();
}
}
function myalert()
{
alert("Shift++++ :)");
}
</script>
</html>
what will be happen you press the "shift" and "+"?
|
|
|
|
|
When I say Shift + : I mean when the user presses and holds the Shift key while pressing the Colon/Semi colon key.
|
|
|
|
|
Hello everybody.......
The data is stored in the MSSQL 2005 with raw fieldnames like field1, field 2 etc., There is a XML file with Descriptive text for all the fields. Its like I have to fetch the data from the SQL and use the header/description corresponding to the fields from the XML to report it in the .aspx file.
I have the data imported via the tableadapter. I should be able to read the XML file and extract the field name and description in to an array. Am Not sure whether this is the right way of doing it??? Even if I could extract, not sure about how to associate the header in the array and the data in the dataset. Any ideas will be sincerely appreciated. thanks in advance.
|
|
|
|
|
If you have an xml file, or fragment, why do you need to create an array? Use XDocument, or XElement to navigate the document. If you're not using .net 3.5 XDocument will work also.
only two letters away from being an asset
|
|
|
|
|
Hi !! everyone
My problem is that , I am using Grid View Control with pagination.. pagination is working perfectly.. I am using 10 check boxes in each row. Selecting/ deselecting them using java script.. I select particular role from combo box assign it with access(using check boxes) and sending those values to database. After that when i select particular role, i want to show those saved values... But only those much rows get populated which r present in first page of grid view control and which r present on second page not reflected.. please send me some solution if there is....
|
|
|
|
|
can you clarify your question as i am not getting that first page data is reflected and other are's not.
please put your code with details explanation.
Regards
Keyur Satyadev
|
|
|
|
|
 Thanks for your instant reply, Keyur
Sorry for not posting code ...
here is the situation.......
i hv Grid View Control consist of two labels and 10 check boxes...
<asp:GridView ID="GrdAccess" runat="server" AutoGenerateColumns="False" DataKeyNames="OptionId" Width="100%" OnRowCommand="GrdAccess_RowCommand" OnRowDataBound="GrdAccess_RowDataBound" AllowPaging="false" ondatabound="GrdAccess_DataBound" onpageindexchanging="GrdAccess_PageIndexChanging"
> <
Columns> <asp:TemplateField HeaderText="OptionId" Visible="false">
<ItemTemplate> <asp:Label ID="lblOptionId" runat="server" Text='<%# Bind("OptionId")%>'></asp:Label> </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="OptionName"
><ItemTemplate> <asp:Label ID="lblOption" runat="server" Text='<%# Bind("OptionName")%>'></asp:Label> </ItemTemplate> </asp:TemplateField>
<asp:TemplateField HeaderText="Acronym" Visible="False" > <ItemTemplate>
<asp:Label ID="lblAcronym" runat="server" Text='<%# Bind("Acronym")%>'></asp:Label> </ItemTemplate> </asp:TemplateField>
<asp:TemplateField HeaderText="Create/Add"> <ItemTemplate>
<asp:CheckBox ID="ChkNew" runat="server" AutoPostBack="true" TextAlign="Left" /> <asp:HiddenField ID="HidChkNew" runat="server" Value="C" /> </ItemTemplate> <HeaderStyle HorizontalAlign="Left" /> <ItemStyle HorizontalAlign ="Center" VerticalAlign="Middle" /> </asp:TemplateField> <asp:TemplateField HeaderText="Edit">
<ItemTemplate> <asp:CheckBox ID="ChkEdit" runat="server" AutoPostBack="true" />
<asp:HiddenField ID="HidChkEdit" runat="server" Value="E" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> </asp:TemplateField>
<asp:TemplateField HeaderText="Delete"> <ItemTemplate>
<asp:CheckBox ID="ChkDelete" runat="server" AutoPostBack="true" />
<asp:HiddenField ID="HidChkDelete" runat="server" Value="D" />
</ItemTemplate> <ItemStyle HorizontalAlign="Center" /> </asp:TemplateField>
<ItemTemplate> <asp:CheckBox ID="ChkAll" runat="server" AutoPostBack="true" />
</ItemTemplate>
</asp:TemplateField> </Columns>
<EmptyDataTemplate>
No Data Found
</EmptyDataTemplate>
</asp:GridView>
On Save button click i am saving all selected access into database..
i am using function similar to this
protected void CmdSave_Click(object sender, EventArgs e)
{
string StrRoleAcccess = "";
string StrOption = "";
string StrChkAccess = "";
string StrFlag = "";
if (CBRoleName.SelectedItem.Text != "--Select--")
{
trErrMessage.Visible = false;
for (int RowCnt = 0; RowCnt < GrdAccess.Rows.Count; RowCnt++)
{
foreach (GridViewRow RowFile in GrdAccess.Rows)
{
for (int i = 2; i < RowFile.Cells.Count; i++)
{
//RowFile.Cells[2].Controls[1].ID
if (RowFile.Cells[i].Controls[1].GetType() == typeof(CheckBox))
{
CheckBox ObjCnt = new CheckBox();
ObjCnt = (CheckBox)RowFile.Cells[i].Controls[1];
if (ObjCnt.Checked)
{
StrFlag = "True";
// FrLoadChkCount++;
} } } }
if (StrFlag == "True")
{
foreach (GridViewRow RowFile in GrdAccess.Rows)
{
for (int i = 2; i < RowFile.Cells.Count - 1; i++)
{
//RowFile.Cells[2].Controls[1].ID
if (RowFile.Cells[i].Controls[1].GetType() == typeof(CheckBox))
{
CheckBox ObjCnt = new CheckBox();
ObjCnt = (CheckBox)RowFile.Cells[i].Controls[1];
if (ObjCnt.Checked)
{
{
Label LblFldOption = (Label)RowFile.Cells[i].FindControl("lblAcronym");
StrOption = LblFldOption.Text.ToString().Trim() + "_";
HiddenField HidCnt = (HiddenField)(RowFile.Cells[i].FindControl("Hid" + ObjCnt.ID));
StrChkAccess = HidCnt.Value;
StrRoleAcccess += "," + StrOption + StrChkAccess;
} } }}}
StrRoleAcccess = StrRoleAcccess + ","+Session["ArrayTobeSaved"].ToString();
...... //Saving those value in database
}}}
I am able maintain the status of all check boxes in every page on pagination...
I use RememberOldValues() and RestoreOldValues() function for that..
I am facing the problem when I retrieve all saved status of check boxes from database and show them when user select particular role from Combo box.
The status of selected Check boxes of first page get reflected but the status of check boxes on second page did not get reflected... one can say binding data to second page of grid view is not working....
here is some part of coding
protected void CBRoleName_SelectedIndexChanged(object sender, EventArgs e)
{
Session["ArrayTobeSaved"] = "";
string[] StrArrOptionAcroName;string[] StrArrOptionName;string StrOptionName;
DataTable DtObjRAccess = CSUserRole.RoleAccesslist(CBRoleName.SelectedItem.Value);
GridView DemoGrid = new GridView();
DemoGrid.DataSource = DtObjRAccess;
int pageCount = GrdAccess.PageCount;
int DemoPageCount=0;
if (DtObjRAccess.Rows.Count > 0)
{
for (int RowCnt = 0; RowCnt < DtObjRAccess.Rows.Count; RowCnt++)
{
StrOptionName = DtObjRAccess.Rows[RowCnt].ItemArray[0].ToString();
if (StrOptionName != "")
{
StrArrOptionAcroName = StrOptionName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
StrArrOptionName = new string[StrArrOptionAcroName.GetLength(0)];
var Optname = new ArrayList();
var AcroName = new ArrayList();
for (int index = 0; index < StrArrOptionAcroName.Length; index++)
{
StrArrOptionName = StrArrOptionAcroName[index].Split('_');
Optname.Add(StrArrOptionName[0]);
AcroName.Add(StrArrOptionName[1]);
}
for (int rowIndex = 0; rowIndex < Optname.Count; rowIndex++)
{ int i=0;
int j=0;
DemoPageCount = 0;
while (DemoPageCount < pageCount)
{
i=0;
j=9;
for(int p=i;p<=j;p++)
{
GridViewRow GrdRow= GrdAccess.Rows[p];
Label LblON = (Label)GrdRow.FindControl("lblAcronym");
if (LblON.Text == Optname[rowIndex].ToString())
{
int rdx = Convert.ToInt32(GrdRow.ID);
switch (AcroName[rowIndex].ToString())
{
case "C":
CheckBox objChk = (CheckBox)GrdRow.FindControl("ChkNew");
if (objChk.Enabled)
{ objChk.Checked = true; }
break;
case "E":
CheckBox objChkE = (CheckBox)GrdRow.FindControl("ChkEdit");
objChkE.Checked = true;
break;
case "D":
CheckBox objChkD = (CheckBox)GrdRow.FindControl("ChkDelete");
objChkD.Checked = true;
break;
}
}
}//end for
DemoPageCount++;
GrdAccess.PageIndex = DemoPageCount;
}//endwhile
}
//
}
}
}
}
else
{ }
}
...
Can u help me in this situation ......
|
|
|
|
|
|
Good Answer
If It Helps Click It as Answer
|
|
|
|
|
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Thanks for your instant reply, Abhijit.
But i have already done that.. I am able maintain the status of all check boxes in every page on pagination...
I use RememberOldValues() and RestoreOldValues() function for that..
I am facing the problem when I retrieve all saved status of check boxes from database and show them when user select particular role from Combo box.
The status of selected Check boxes of first page get reflected but the status of check boxes on second page did not get reflected... one can say binding data to second page of grid view is not working....
Can u help me in this situation ......
|
|
|
|
|
Is it possible to maintain treeview state across postbacks? I have a treeview on a masterpage. I want the treeview to maintain its expand/colapse state when the user navigates to different pages.
|
|
|
|
|
If am not sure if you tried to serach this on google, but I found some very interesting links. Give this [^]a try.
And if you still do not find any answer, come back here I'll explain this to you.
Don't you think this would be a good learning excercise?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Nothing works.I am unable to maintain the tree view 's expanded /collapsed state
|
|
|
|
|
hi
when i click on submit button, page is postback and value of file upload control is lost.
can i maintain this value. i need value in text area of file upload control.
i got the value using hidden field but its not display in file upload control.
is their any way(s) is find out of this solution?
Regards
Keyur Satyadev
|
|
|
|
|
I think U Can Use Ajax update panel without updating value of File Upload Control or store it in session or query string .
And u Can Retrieve Back.
If It Helps Click It as Answer
|
|
|
|
|
in update panel file upload control will not work properly. i check it.
Regards
Keyur Satyadev
|
|
|
|
|