|
I have a gridview with an update capabilities - a textbox column (roomName), a dropdownlist(orgID), a dropdownlist(roomTypeID),a checkbox column (dialOut), a checkbox column (dialIn). When I try to add another checkbox column, the sql database isn't updated properly with a 0/1 or false/true but with null. I've tried everything I can think of. Can anyone help?
<asp:CommandField ShowEditButton="True" ValidationGroup="valGrp" CancelText="Cxl" EditText="Edit" UpdateText="Upd" />
<asp:BoundField DataField="roomID" />
<asp:TemplateField HeaderText="RoomName">
<EditItemTemplate>
<asp:TextBox ID="txtRoom" Columns="10" runat="server" SkinID="txtSm" Text='<%# Bind("roomname") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblRoom" runat="server" Text='<%# Bind("roomName") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Button ID="btnAdd" runat="server" skinID="btnGo" Text="Add" CommandName="Insert" />
<asp:TextBox ID="txtRoomAdd" Columns="10" runat="server" SkinID="txtSm" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Org">
<EditItemTemplate>
<asp:DropDownList ID="orgDDL" runat="server" SkinID="ddl" DataSourceID="orgDS"
DataTextField="org" DataValueField="orgID" SelectedValue='<%# Bind("orgID") %>'>
</asp:DropDownList><asp:SqlDataSource ID="orgDS" runat="server" ConnectionString="<%$ ConnectionStrings:Str %>"
SelectCommand="select statement"></asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblOrg" runat="server" Text='<%# Bind("org") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="orgDDLAdd" runat="server" SkinID="ddl" DataSourceID="orgAddDS2"
DataTextField="org" DataValueField="orgID">
</asp:DropDownList><asp:SqlDataSource ID="orgAddDS2" runat="server" ConnectionString="<%$ ConnectionStrings:Str %>"
SelectCommand="select statement">
</asp:SqlDataSource>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Type">
<EditItemTemplate>
<asp:DropDownList ID="typeDDL" runat="server" SkinID="ddl" DataSourceID="typeDS"
DataTextField="roomType" DataValueField="roomTypeID" SelectedValue='<%# Bind("roomTypeID") %>'>
</asp:DropDownList><asp:SqlDataSource ID="typeDS" runat="server" ConnectionString="<%$ ConnectionStrings:Str %>"
SelectCommand="select statement">
</asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblroomType" runat="server" Text='<%# Bind("roomType") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="typeDDLAdd" runat="server" SkinID="ddl" DataSourceID="addDS3"
DataTextField="roomType" DataValueField="roomTypeID">
</asp:DropDownList><asp:SqlDataSource ID="addDS3" runat="server" ConnectionString="<%$ ConnectionStrings:Str %>"
SelectCommand="select statement">
</asp:SqlDataSource>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DialOut">
<EditItemTemplate><asp:CheckBox ID="chkOutEdit" runat="server" checked='<%# Bind("dialOut") %>' /></EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkOut" runat="server" checked='<%# Bind("dialOut") %>' Enabled="false" /></ItemTemplate>
<FooterTemplate><asp:CheckBox ID="chkOutAdd" runat="server" /></FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DialIn">
<EditItemTemplate><asp:CheckBox ID="chkInEdit" runat="server" checked='<%# Bind("dialIn") %>' /></EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkIn" runat="server" checked='<%# Bind("dialIn") %>' Enabled="false" /></ItemTemplate>
<FooterTemplate><asp:CheckBox ID="chkInAdd" runat="server" /></FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Webinar">
<EditItemTemplate><asp:CheckBox ID="chkWebEdit" runat="server" checked='<%# Bind("webinarCapable") %>' /></EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkWeb" runat="server" checked='<%# Bind("webinarCapable") %>' Enabled="false" /></ItemTemplate>
<FooterTemplate><asp:CheckBox ID="chkWebAdd" runat="server" /></FooterTemplate>
</asp:TemplateField>
Update stuff:
UpdateCommand="update myTable set roomname=@roomName, orgID=@orgID, roomTypeID=@roomTypeID, dialOut=@dialout, dialIn=@dialin, webinarCapable=@web where roomID = @roomID"
>
<UpdateParameters>
<asp:Parameter Name="roomName" Type="String" />
<asp:Parameter Name="orgID" Type="Int32" />
<asp:Parameter Name="roomTypeID" Type="Int32" />
<asp:Parameter Name="dialout" Type="Byte" />
<asp:Parameter Name="dialin" Type="Byte" />
<asp:Parameter Name="web" Type="Byte" />
</UpdateParameters>
TABLE [dbo].[myTable](
[roomID] [int] IDENTITY(1,1) NOT NULL,
[roomName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[orgID] [int] NULL,
[roomTypeID] [int] NULL,
[dialOut] [bit] NULL CONSTRAINT [DF_xTblRoom_dialOut] DEFAULT ((0)),
[dialIn] [bit] NULL CONSTRAINT [DF_xTblRoom_dialIn] DEFAULT ((0)),
[webinarCapable] [bit] NULL CONSTRAINT [DF_xTblRoom_webinarCapable] DEFAULT ((0))
|
|
|
|
|
Not sure what I did wrong, still, but I deleted the aspx page and started over from scratch. Everything works fine now..... Scratchin' my head hard!
|
|
|
|
|
Hi,
We are building an ASP.NET page and in that we need place a Scrollable Panel containing a ListView.
The ListView in-turn will hold different records, which are retrieved from Database.
Could anyone please refer a code sample for this?
Thanks and Regards.
|
|
|
|
|
Place the ListView in a div and apply the CSS property overflow:scroll to it.
only two letters away from being an asset
|
|
|
|
|
concatenated three dropdownlists values i inserted year month day into a column in sql table.
how to retrieve that values seperately to that three ddls from sql table
help plz...
for inserting i used....
string str = DropDownList5.SelectedItem.Value.ToString();
string str1 = DropDownList6.SelectedItem.Value.ToString();
string str2 = DropDownList7.SelectedItem.Value.ToString();
string final = str1 + "-" + str + "-" + str2;
cmd.Parameters.Add("@startdate", SqlDbType.SmallDateTime.ToString()).Value = final;
|
|
|
|
|
madhukk wrote: cmd.Parameters.Add("@startdate", SqlDbType.SmallDateTime.ToString()).Value = final;
Try This .
DateTime MyDateTime;
MyDateTime = new DateTime();
MyDateTime = DateTime.ParseExact(final , "yyyy-MM-dd",
null);
cmd.Parameters.Add("@startdate",MyDateTime );
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
im able to insert it..
i want to retrieve startdate column and transfer to other page using session..
using datareader i stored that column in a string
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{ Session["startdate"] = dr["startdate"];
}
in next page to tranfer the value
if i write this
DropDownList1.SelectedItem.Text= Session["startdate"].ToString();
im getting complete date(10/20/2001) in DropDownList1..
but what i want is ddl1(10) ddl2(20) ddl3(2001) as i inserted...
|
|
|
|
|
madhukk wrote: im getting complete date(10/20/2001) in DropDownList1..
Which is exactly what you coded. If you want to separate the values across different drop downs then you need to separate the components of the date. Day to one, month to another, and year to the third. How complicated can this be?
|
|
|
|
|
You need to split them before store.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
thats what im unable to any sample code please..
|
|
|
|
|
madhukk wrote: any sample code please..
One sample code for you.
String DateText="12/10/2009";
String [] DatePart= DateText.Split('/');
string dd=DatePart[0].ToString();
string mm=DatePart[1].ToString();
string yy=DatePart[2].ToString();
Hope you can take it forward. Let me know if any more issue.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I would prefer this one as it does not believe on string manipulatio and when we have datetime datatype then why do string manipulation?
String strDate = "12/27/2009";
String strFormat = "mm/dd/yyyy";
System.Globalization.CultureInfo provider = System.Globalization.CultureInfo.InvariantCulture;
DateTime dt = DateTime.ParseExact(strDate, strFormat, provider);
String dd = dt.Day.ToString();
String mm = dt.Month.ToString();
String yyyy = dt.Year.ToString();
|
|
|
|
|
Yes Nish, You are Correct. Actually there are many ways that we can implement it. I have given a very basic example. You given much better!
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
If everybody stored their datetime values properly as DateTime values and not as strings they would not get into this mess. Who is teaching all these awful habits?
|
|
|
|
|
Session["headline"] = dr["headline"];
Session["startdate"] = dr["startdate"];
Response.Redirect("newsedit.aspx");
next page
TextBox5.Text = Session["headline"].ToString();
String DateText = Session["startdate"].ToString();
String[] DatePart = DateText.Split('/');
string dd = DatePart[0].ToString();
string mm = DatePart[1].ToString();
string yy = DatePart[2].ToString();
DropDownList6.SelectedItem.Text=dd.ToString();
Object reference not set to an instance of an object.
|
|
|
|
|
madhukk wrote: Session["headline"] = dr["headline"];
Session["startdate"] = dr["startdate"];
Response.Redirect("newsedit.aspx");
next page
TextBox5.Text = Session["headline"].ToString();
String DateText = Session["startdate"].ToString();
String[] DatePart = DateText.Split('/');
string dd = DatePart[0].ToString();
string mm = DatePart[1].ToString();
string yy = DatePart[2].ToString();
DropDownList6.SelectedItem.Text=dd.ToString();
Object reference not set to an instance of an object.
What is ur question ?
madhukk wrote: DropDownList6.SelectedItem.Text=dd.ToString();
Object reference not set to an instance of an object.
I guess this one.
What is the value of dd.ToString(); ? Does this exist on the dropdownlist? Hope now you understand what I want to mean
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
SELECT DAY(startDate) as day, MONTH(startDate) as month, YEAR(startDate) AS Year FROM YourTable
|
|
|
|
|
J4amieC wrote: SELECT DAY(startDate) as day, MONTH(startDate) as month, YEAR(startDate) AS Year FROM YourTable
No, no, no! That's MUCH too sensible ...
|
|
|
|
|
Hi,
I need to display the content in my site of a particular link using RSS.
Eg:
When a user click the link of a new which is displayed using RSS, i need to display the content also in my page, without going to another site or source site. For yahoo RSS we get all links, When we click a link it will redirect to yahoo site for the content.
How can i bring the content in to my site without going to yahoo? How it possible? Is it possible?
Thankyou
YPKI
|
|
|
|
|
I have already provided you the information in your last thread. For details you need to search google. If need to read all the content of RSS nothing else.
Please read this article,
An ASP.NET RSS Feed Reader[^]
Let me know if it clear to you !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I try this article.. but the content is opening in www.megatokyo.com site. My requriment is to display the particular content in my site itself.. is it possible?
|
|
|
|
|
Yes. make a HTTPRequest for that site. Read the HTTPResponse. Parse the text and display it in your page.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
can u please provide me an example
|
|
|
|
|
hi Abhijit ,
Can u provide me a example
|
|
|
|
|
Hi All,
i have question, in my project most of user control is Register in page as traditional manner. If i change to load the user control dynamically, Is any performance difference will be there.
My question is, i need to improve performance of page.If i load the user control dynamically.any improvement of Performance?
Please suggest Me.
Thanks In Advance..
JohnDas
|
|
|
|