|
Create three columns (Step1 , Step2 and Step3 ) using the bit type. (This corresponds to the Boolean type in .NET.)
Find the items in the CheckBoxList and add them as separate parameters:
Dim item As ListBoxItem = ckRequestReview.Items.FindByText("Step One")
cmd.Parameters.AddWithValue("@Step1", item IsNot Nothing AndAlso item.Selected)
item = ckRequestReview.Items.FindByText("Step Two")
cmd.Parameters.AddWithValue("@Step2", item IsNot Nothing AndAlso item.Selected)
item = ckRequestReview.Items.FindByText("Step Three")
cmd.Parameters.AddWithValue("@Step3", item IsNot Nothing AndAlso item.Selected)
When you query the data, just select the three columns. The value of each column will be True if the item was selected, and False otherwise.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Awesome!
Thanks so much for your continued support Richard.
|
|
|
|
|
Yes, you can put you CheckBoxList Value into DB.
|
|
|
|
|
i Want to display an multiple images using datalist
asp Code:
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" RepeatDirection="Horizontal"
Width="100%" BorderColor="#336699" BorderStyle="Solid" BorderWidth="2px">
<ItemTemplate>
<asp:Label ID="lblsStatus" runat="server"></asp:Label>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("imgname1") %>' Font-Bold="True"
Font-Size="10pt" ForeColor="#336699" Width="100%" />
<br />
<asp:Image ID="imgsss" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
</asp:DataList>
c#:
protected void Page_Load(object sender, EventArgs e)
{
FetchImage();
}
private object GetData(string query)
{
DataTable dt = new DataTable();
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand(query))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
sda.SelectCommand = cmd;
sda.Fill(dt);
}
}
return dt;
}
}
protected void FetchImage()
{
string id = "1";
imgss.Visible = id != "0";
if (id != "0")
{
byte[] bytes = (byte[])GetData("SELECT imgdata1 FROM Tbl_images WHERE id =" + id);
string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
imgss.ImageUrl = "imgdata1:image/png;base64," + base64String;
}
}
|
|
|
|
|
You didn't told what the problem, but I can spot a syntax problem that fixing it may help you...
... = "imgdata1:image/png;base64,"...
It should be
... = "data:image/png;base64,"...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
error:
Unable to cast object of type 'System.Data.DataTable' to type 'System.Byte[]'.
|
|
|
|
|
And?
Are you really meant to convert the DataTable to byte array? Or by any chance you want to convert the field's content?
Change GetData so it will return only the data you need, something like this:
dt.Rows[0]["column-name-for-image-data"]
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
You are returning the wrong object type from your GetData method. A DataTable is not compatible with a Byte[] , so you cannot use a cast.
|
|
|
|
|
Two option for you .
1. Just Change "imgdata1" to "data" in you code .. for example
imgss.ImageUrl="data:image/png;base64," + base64String;
2. With the use of Handler file. (Do Google for it)
|
|
|
|
|
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
Also, you won't have a control called imgss at the page level. The control is defined within a data-bound list; once the list is data-bound, there will be one copy of the control for each item in the list.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
HI,
This the code:-
foreach(GridViewRow row in GridView1.Rows)
{
if(row.RowType==DataControlRowType.DataRow)
{
//code here
}
}
I didn't understand this line of code: if(row.RowType==DataControlRowType.DataRow)
Can anyone help???
|
|
|
|
|
the DataControlRowType can be the following:
DataRow
EmptyDataRow
Footer
Header
Pager
Separator
so if the row is a "DataRow" then it is a row with data
|
|
|
|
|
|
I am willing to embed live video into my asp.net+vb web page.
The input is from the camera and it is connected to the inbuilt DVR Card (in AGP slot in my PC)
i dont want to use the interface provided by the DVR firm. as they shows their names and menu
i want iyt to be embeded and futher i can change the layout etc.
|
|
|
|
|
Dear All!...
I am working in asp.Net with c# Language. I am using Date Time Picker with Text Box. If i am pick the Text Box date time picker is show in first time after Refresh the page date time picker is not shown again.(Note:I am using master page).
Following Script i am using in my page.
$(function () {
$(".date").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd M yy',
yearRange: "-100:+10"
});
});
Thanks for advance!....
|
|
|
|
|
Let me guess, there is something vitally important about your problem you have chosen not to tell us, such that you're using an updatepanel, or some other kind of ajax?
|
|
|
|
|
|
In Google Chrome, hit F12, go to Console tab, see if you have any JavaScript errors.
|
|
|
|
|
Currentlly i have started on gps tracking software and i have no idea about it. Plz help me on this. On gps device i set ip and port then after on particular time interval gps send the data on server. Please tell me how to capture this data. Its urgent for me please help.
|
|
|
|
|
Amitk765 wrote: and i have no idea about it So pick your favorite search engine and start looking for material for your subject...
As now you only have a - somewhat hidden - code request only...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
But, but it's urgent, don't ya see!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
How to drag cities into dropdownlist (city) from selected dropdownlist (state) of respected state.
E.g. In dropdownlist selected state is Maharashtra, so drag all respected state cities into dropdownlist (city).
|
|
|
|
|
It would require a lot of code. Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Google "asp.net cascading dropdowns" and you'll find various ways of making one dropdown rely on the value of another. You'll need to get the actual data from somewhere yourself though.
|
|
|
|
|
Here, You have to use Dropdown DataTextField & DataValueField . in DataTextField you have to show State like Maharashtra and in DataValueField you have to set their State_id . after that you have to fetch city data through this state_id in Database.
|
|
|
|