|
Hi,
I have a Dictionary<string,> object that uses the Item name as the Key (string) and Size as the Item (decimal). However, on some occasions, the Item name repeats itself, but the itemIDs are always unique. So, I want to switch my Dictionary<string,> to be Dictionary<int,decimal>. My problem occurs when I am trying to get items that are checked from the datagrid. Right now this is the code:
public void GetChecked()
{
Dictionary<string,decimal> Checked=(Dictionary<string,decimal> )Session["CheckedItems"];
string itemname;
CheckBox cb;
TextBox tb;
if (Checked !=null)
{
foreach (GridViewRow gvRow in gvwItems.Rows)
{
itemname= gvRow.DataKeys[row.RowIndex].Value.ToString();
if(Checked.ContainsKey(itemname))
.
.
.
.
How do I alter this code to read the item_id which is an integer and not a string?
Please help if you can, I am very stuck on this and do not know how to proceed.
Thank you.
|
|
|
|
|
Dictionary<int,decimal> Checked=(Dictionary<int,decimal> )Session["CheckedItems"];
int itemname;
CheckBox cb;
TextBox tb;
if (Checked !=null)
{
foreach (GridViewRow gvRow in gvwItems.Rows)
{
itemname= Convert.ToInt32(eRow.DataKeys[row.RowIndex].Value.ToString());
if(Checked.ContainsKey(itemname))
...
...
...
|
|
|
|
|
I made the changes you suggested and am now getting the following error:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException occurred in mscorlib.dll but was not handled in user code
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
How do i fix this?
|
|
|
|
|
Does it tell you at which line the exception occurred?
|
|
|
|
|
how to use session method in an application
|
|
|
|
|
Have a look here[^]
Calin
|
|
|
|
|
if u ask the same question to google ,you were able to get the answer instantly in that time.U wasted ur and other's time
|
|
|
|
|
i have store data use check box selected in text
how cant retrieve data in check box retrieve time fill the check box selected with find own text
like
store database text in mango
fruits banana[] mango[,] orange[]
|
|
|
|
|
Wow
We all know that English is not our First Language some of us , but atleast try not to write what you dont know. Can you please use the Basic English. I cant really Figuire out what you are trying to say. Can you please explain again, this time take your time.
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
You have been asking the same question for DAYS. Are you stupid ? Have you written any code at all ? Did you try reading some articles here on code project or generally on the web ? Is someone paying you day after day to play solitaire and wait for someone here to decipher your repeated posts and do your job for you ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
Seriously, this guy has probably got a job at a place that got the work b/c it was 1/10 the cost of hiring people in the West. And, that's fine, but, they are that cheap b/c they have no idea how to do their jobs. I don't mind helping people, regardless of where they are or what they are coding for, but I assume a basic level of ability, and willingness to learn. I sure expect some thought to be put into a question, instead of the same thing being posted day after day.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yes, you have right.
Calin
|
|
|
|
|
Hi all,
I have a query to make.I have created a website in VS2005.I wish to publish it on IIS 5.1 which is on another PC on the network.But that PC has VS2003(instead of VS2005).Is there a way to publish my website on that IIS?Further my query stays the same for IIS 6.0.Please help.My delivery date is drawing nearer and m under immense pressure.
|
|
|
|
|
Publishing has nothing to do with the Vesrion of the VS.
When you are done and satisfied that your Application is working fine. Go to that PC with IIS5 and Create a Virual Directory and paste those Files there. Go to your IIS Configure some settings that you will need
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Thanks for your help..I think now I can work easily..
|
|
|
|
|
Glad be at your service
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Hi. I am trying to retrieve the text of a textbox from code behind after setting the text via javascript (JS) on the page itself.
I do it like this via JS on a html radiobutton event:
var provider = document.getElementById('<%=txtMailProvider.ID %>');
provider.value = '@blah.com';
I then try to get that text from the txtbox on a server button click event, in code like:
string blah = txtMailProvider.Text; this bring back and empty string.
Is there another, working, way to do this? Tried google, etc
Any help would be great.
Thanks
M
|
|
|
|
|
is '@blah.com' still in the textbox after you press button?
|
|
|
|
|
yes it is, I see it set within the txtbox.
|
|
|
|
|
Firstly, check that EnableViewState hasn't been set to false on your text box.
It's true by default so it will only be false if you or another programmer has added: EnableViewState="false"
|
|
|
|
|
Thanks guys for the help, I am using a hidden input field instead (last resort. )
|
|
|
|
|
Following is my userdefined Template as CoreVocabularyFields.ascx
<%@ Control Language="C#" ClassName="CoreVocabularyFields" %>
<script language="C#" runat="server">
public void PopulateCoreType(object sender, EventArgs e)
{
EntityDropDownList list = (EntityDropDownList)FormUtil.FindControl(((Control)sender).NamingContainer, "dataCoreTypeId");
CoreTypeDataSource datasource = (CoreTypeDataSource)FormUtil.FindControl(((Control)sender).NamingContainer, "CoreTypeIdCoreTypeDataSource");
if (list != null)
{
list.DataSource = datasource;
list.DataTextField = "NetTypeName";
list.DataValueField = "Id";
list.DataBind();
}
}
</script>
<asp:FormView ID="FormView10" runat="server">
<ItemTemplate>
<table border="0" cellpadding="3" cellspacing="1">
<tr>
<td class="literal"><asp:Label ID="lbldataTerm" runat="server" Text="Term:" AssociatedControlID="dataTerm" /></td>
<td>
<asp:TextBox runat="server" ID="dataTerm" Text='<%# Bind("Term") %>' TextMode="MultiLine" Width="250px" Rows="5"></asp:TextBox><asp:RequiredFieldValidator ID="ReqVal_dataTerm" runat="server" Display="Dynamic" ControlToValidate="dataTerm" ErrorMessage="Required"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="literal"><asp:Label ID="lbldataCoreTypeId" runat="server" Text="Core Type Name:" AssociatedControlID="dataCoreTypeId" /></td>
<td>
<table border="0">
<tr> <td valign="middle" style="width:100px;">
<data:EntityDropDownList runat="server" ID="dataCoreTypeId" DataSourceID="CoreTypeIdCoreTypeDataSource" DataTextField="JavaTypeName" DataValueField="Id" SelectedValue='<%# Bind("CoreTypeId") %>' AppendNullItem="true" Required="true" NullItemText="< Please Choose ...>" ErrorText="Required" />
<data:CoreTypeDataSource ID="CoreTypeIdCoreTypeDataSource" runat="server" SelectMethod="GetAll" />
</td>
<td valign="top">
<table>
<tr>
<td><font style="color:Gray; font-weight:bold;">Select By :</font></td>
<td><asp:RadioButton AutoPostBack="true" ID="JavaType" GroupName="CoreType" runat="server" OnCheckedChanged="PopulateCoreType" Checked="true" /></td>
<td><font style="color:Gray; font-weight:bold;">JavaTypeName</font></td>
<td><asp:RadioButton AutoPostBack="true" ID="NetType" GroupName="CoreType" OnCheckedChanged="PopulateCoreType" runat="server" /></td>
<td><font style="color:Gray; font-weight:bold;">NetTypeName</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td>
<%----%>
<div id="divAddCoreType" style="display:none;">
<data:MultiFormView ID="FormView2" DataKeyNames="Id" runat="server" DataSourceID="CoreTypeDataSource" DefaultMode="Insert">
<EditItemTemplatePaths>
<data:TemplatePath Path="~/Admin/UserControls/CoreTypeFields.ascx" />
</EditItemTemplatePaths>
<InsertItemTemplatePaths>
<data:TemplatePath Path="~/Admin/UserControls/CoreTypeFields.ascx" />
</InsertItemTemplatePaths>
<EmptyDataTemplate>
<b>CoreType not found!</b>
</EmptyDataTemplate>
<FooterTemplate>
<asp:Button ID="InsertButton" runat="server" CausesValidation="False" CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</FooterTemplate>
</data:MultiFormView>
<data:CoreTypeDataSource ID="CoreTypeDataSource" runat="server" SelectMethod="GetAll" />
</div>
</td>
</tr>
<tr>
<td class="literal"><asp:Label ID="lbldataMeaning" runat="server" Text="Meaning:" AssociatedControlID="dataMeaning" /></td>
<td>
<asp:TextBox runat="server" ID="dataMeaning" Text='<%# Bind("Meaning") %>' TextMode="MultiLine" Width="250px" Rows="5"></asp:TextBox><asp:RequiredFieldValidator ID="ReqVal_dataMeaning" runat="server" Display="Dynamic" ControlToValidate="dataMeaning" ErrorMessage="Required"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</ItemTemplate>
</asp:FormView>
In the above code I want to change the DataTextField of the DropDownList(Id: dataCoreTypeId) on the OnCheckedChanged event of the Radio Button
(Having Text as JavaType Name and NetType Name)
I am using this template in the CoreVocabulary.aspx page inside MultiFormView Tag
<%@ Page Language="C#" Theme="Default" MasterPageFile="~/MasterPages/admin.master" AutoEventWireup="true" CodeFile="CoreVocabularyEdit.aspx.cs" Inherits="CoreVocabularyEdit" Title="CoreVocabulary Edit" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">Core Vocabulary - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<data:MultiFormView ID="FormView1" DataKeyNames="Id" runat="server" DataSourceID="CoreVocabularyDataSource">
<EditItemTemplatePaths>
<data:TemplatePath Path="~/Admin/UserControls/CoreVocabularyFields.ascx" />
</EditItemTemplatePaths>
<InsertItemTemplatePaths>
<data:TemplatePath Path="~/Admin/UserControls/CoreVocabularyFields.ascx" />
</InsertItemTemplatePaths>
<EmptyDataTemplate>
<b>CoreVocabulary not found!</b>
</EmptyDataTemplate>
<FooterTemplate>
<asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</FooterTemplate>
</data:MultiFormView>
<data:CoreVocabularyDataSource ID="CoreVocabularyDataSource" runat="server"
SelectMethod="GetById"
>
<Parameters>
<asp:QueryStringParameter Name="Id" QueryStringField="Id" Type="String" />
</Parameters>
</data:CoreVocabularyDataSource>
</asp:Content>
But when I click the radio button I got the error as
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Thanks
|
|
|
|
|
Hello,i want to store video and picture file with the unique user(the member or existing user)using SQL2000,the what relation will be suitable,[user table](PK--user_ID
User_Name,User_Password)[Resume table](PK--CV_ID, FK--User_ID,name,father_name ect)[Picture table](PK--Pic_ID, FK--CV_ID,picture,Content type,size,data)[Video table](PK--Video_ID, FK--CV_ID, Video_name,Content type,size,data) is this correct relation ship?and should i use user_id Fk in video and picture table?and also i want show the data for register member.
|
|
|
|
|
in my situation in one click event i have to insert data into a sql table as well as oracle table.Now i want to use transactions but the problem is either i have to use oracle transaction which does not support oracle command or sql transaction which does not support sql command.What i have to do in this situation.I want to do that if one of the two query fails to execute other one must be roll back.
Thanx in advance
|
|
|
|